#include <iostream>
using namespace std;

char vec[12][13];

void def(int x, int y) {
    vec[x][y] = '0';
    if(vec[x+1][y]=='1') 
        def(x+1, y);
    if(vec[x][y+1]=='1')
        def(x, y+1);
    if(vec[x-1][y]=='1')
        def(x-1, y);
    if(vec[x][y-1]=='1')
        def(x, y-1);
}

int main() {
    while(1) {
        for(int i = 0; i < 12; i++) {
            for(int j = 0; j < 12; j++) {
                cin >> vec[i][j];
            }
        }
        if(cin.eof())return 0;

        int ans = 0;
        for(int i = 0; i < 12; i++) {
            for(int j = 0; j < 12; j++) {
                if(vec[i][j] == '1') {
                    ans++;
                    def(i, j);
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}
