type xx=record x,y:longint; end; var m,n, i,j,k,sum,r,h :longint; q :array[0..10001]of xx; a :array[0..100,0..100]of boolean; u :array[1..4]of integer=(1,-1,0,0); v :array[1..4]of integer=(0,0,-1,1); x :char; procedure bfs(i,j:longint); begin h:=0;r:=1;q[1].x:=i;q[1].y:=j;a[i,j]:=false; while hord('0') then a[i,j]:=true else a[i,j]:=false; end; readln; end; for i:=1 to m do for j:=1 to n do if a[i,j] then begin inc(sum); bfs(i,j); end; writeln(sum); close(input); close(output); end.