#include <stdio.h>
char RB[13][13];int f[4][2]={1,0,-1,0,0,1,0,-1};void dfs(int x, int y) {RB[x][y]='0';for (int k=0;k<4;k++) {int a=x+f[k][0],b=y+f[k][1];if (a>=0 && a<12 && b>=0 && b<12 && RB[a][b]=='1') dfs(a,b);}}
int main() {int i,j,k;while (scanf("%s",&RB[0])!=EOF) {for (i=1;i<12;scanf("%s",&RB[i++]));k=0;for (i=0;i<12;i++) for (j=0;j<12;j++) if (RB[i][j]=='1') k++,dfs(i,j);printf("%d\n",k);}return 0;}