#!ruby -na00F\n
a=[[z=?0]*12]+$F.map{|l|[z]+l.chars}+[[]]
c=0
x=(1..12)
x.map{|i|x.map{|j|q=[]
a[i][j]>z&&(c+=1;q<<[i,j])
(k,l=q.pop;a[k][l]=z;[[0,0],[1,0],[0,1],[-1,0],[0,-1]].map{|c,d|(a[k+c][l+d]||z)>z&&q<<[k+c,l+d]})while q!=[]}}
p c