import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main extends App {

  Iterator.continually(readLine).takeWhile( _ != null ).foreach { s=>
    val b = new ArrayBuffer[String]
    var cnt = 0

    if(s=="") b+= readLine else b+= s
    for( i<- 1 to 11)
      b += readLine
    println(b.toArray.mkString("\n"))

    for(i <- 0 until 12) {
      var j = 0
      while(j<12) {
        if(b(i)(j) == '1') {
          if(i==0) { cnt += 1; while(j<12 && b(i)(j) == '1') j+=1 }
          else {
            var flg = true
            while(j<12 && b(i)(j) == '1') {
              if(b(i-1)(j)=='1') flg = false
              j+=1
            }
            if(flg) cnt += 1
          }
        } else j+=1
      }
    }
    println(cnt)
  }
}