require 'thread'

$dy = [0,1,0,-1]
$dx = [1,0,-1,0]

$visited = nil
$field = nil

def dfs(y, x)
  $visited[y][x] = true
  4.times{|i|
    yy = y + $dy[i]
    xx = x + $dx[i]
    next if yy < 0 || yy >= 12 || xx < 0 || xx >= 12
    next if $visited[yy][xx]
    dfs(yy,xx) if $field[yy][xx] == "1"
  }
end

def solve()
  $field = []
  12.times{
    tmp = gets
    return true if tmp == nil
    $field.push(tmp.strip)
  }
  gets

  # p $field

  $visited = Array.new(12){Array.new(12,false)}

  ans = 0
  12.times{|y|
    12.times{|x|
      if $visited[y][x] == false && $field[y][x] == "1"
        dfs(y,x)
        ans += 1
      end
    }
  }
  p ans
  return false
end

while true
  owari = solve()
  break if owari
end