#include <iostream>
#include <string>
 
int CountIsland(std::string* map);
void DeleteIsland(int x,int y,std::string* map);
 
int main()
{
    std::string map[12]={};
    do{
        for(int i=0;i<12;i++){
            if(!(std::cin>>map[i])){
                return 0;
            }
        }
        std::cout<<CountIsland(map)<<std::endl;
    }while(std::cin);
}
int CountIsland(std::string* map)
{
    int island=0;
    for(int i=0;i<12;i++){
        for(int j=0;j<12;j++){
            if(map[i][j]=='1'){
                island++;
                DeleteIsland(i,j,map);
            }
        }
    }
    return island;
}
void DeleteIsland(int x,int y,std::string* map)
{
    map[x][y]='2';
    if(x>0&&map[x-1][y]=='1'){
        DeleteIsland(x-1,y,map);
    }
    if(x<11&&map[x+1][y]=='1'){
        DeleteIsland(x+1,y,map);
    }
    if(y>0&&map[x][y-1]=='1'){
        DeleteIsland(x,y-1,map);
    }
    if(y<11&&map[x][y+1]=='1'){
        DeleteIsland(x,y+1,map);
    }
}
 