#include<iostream>
#include<cstdio>
#include<cstring>
#include <iomanip>
#include<string>
#include<cmath>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<cctype>
#include<stack>
#include<queue>
#include<deque>
using namespace std;
#define endl "\n"
int n,res;
int dx[10]={-1,0,1,0},dy[10]={0,1,0,-1};
int g[500][500],llen[500];
int st[500][500];
string s;
struct node{
int x;
int y;
};
queue<node> q;
void bfs(int sstart,int eend){
q.push(node{sstart,eend});
while(!q.empty()){
node temp=q.front();
q.pop();
for(int i=0;i<4;i++){
int xx=dx[i]+temp.x,yy=dy[i]+temp.y;
if(st[xx][yy]==1){
continue;
}
if(g[xx][yy]==0){
continue;
}
if(xx<0 || yy<0 || xx>=n || yy>=llen[xx]){
continue;
}
st[xx][yy]=1;
q.push(node{xx,yy});
}
}
}
int main(){
cin>>n;
s="\n";
getline(cin,s);
for(int i=0;i<n;i++){
getline(cin,s);
llen[i]=s.length();
for(int j=0;j<llen[i];j++){
if(s[j]=='*' || s[j]==' '){
g[i][j]=0;
}else{
g[i][j]=1;
}
}
s.clear();
}
for(int i=0;i<n;i++){
for(int j=0;j<llen[i];j++){
if(st[i][j]==0 && g[i][j]==1){
st[i][j]=1;
bfs(i,j);
res++;
}
}
}
cout<<res;
return 0;
}