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

object Main extends App {
  def del(a:Array[Array[Int]],i:Int,j:Int):Unit  = {
    if(i<0 || j < 0 || i > 11 || j > 11 || a(i)(j) == 0) return
    else {
      a(i)(j) = 0
      del(a,i,j+1);del(a,i,j-1);del(a,i+1,j);del(a,i-1,j)
    }
  }

  Iterator.continually(readLine).takeWhile( _ != null ).foreach { s=>
    val b = new ArrayBuffer[Array[Int]]

    if(s=="") b+= readLine.map(_.asDigit).toArray else b+= s.map(_.asDigit).toArray
    for( i<- 1 to 11)
      b += readLine.map(_.asDigit).toArray

    val a = b.toArray
    for(i <- 0 until 12;j<- 0 until 12)  {
      if(a(i)(j) == 1) {
        del(a,i,j)
        a(i)(j) = 1
      }
    }
    println(a.map{ _.count{_==1} }.sum)
  }
}