#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
const int N = 110;
string s[N];
int len[N], wx[4] = {-1, 0, 1, 0}, wy[4] = {0, 1, 0, -1}, n;
void dfs(int x, int y)
{
s[x][y] = '0';
for (int i = 0; i < 4; ++i)
{
int nx = x + wx[i], ny = y + wy[i];
if (nx >= n || nx < 0 || ny >= len[nx] || ny < 0 || !(s[nx][ny] >= 'a' && s[nx][ny] <= 'z')) continue;
dfs(nx, ny);
}
}
int main()
{
scanf("%d", &n); // 玄学读入问题
char ch = getchar();
while (ch != ' ' && ch != '*' && !(ch >= 'a' && ch <= 'z')) ch = getchar();
s[0].push_back(ch);
for (int i = 0; i < n; ++i)
{
if (i == 0)
{
string s2;
getline(cin, s2);
s[i] += s2;
len[i] = s[i].size();
continue;
}
getline(cin, s[i]);
len[i] = s[i].size();
}
int res = 0;
// for (int i = 0; i < n; ++i) cout << s[i] << endl;
for (int i = 0; i < n; ++i)
for (int j = 0; j < len[i]; ++j)
{
// printf("%c\n", s[i][j]);
if (s[i][j] == '*' || s[i][j] == ' ' || s[i][j] == '0') continue;
dfs(i, j);
res++;
}
printf("%d\n", res);
return 0;
}