import scala.collection.mutable
import scala.io.StdIn._
object Main extends App {
  val n = readInt()
  val area = Array.tabulate(n){_ ⇒ readLine.trim.map{_ == 'o'}.toArray}
  var count = 0
  for (x ← 0 until n by 2; y ← 0 until n by 2 if area(y)(x)) {
    count += 1
    draw(area, x, y)
  }
  println((count - 1) / 3)
  def draw(area: Array[Array[Boolean]], x: Int, y: Int): Unit = {
    val queue = mutable.Queue(Coordinate(x, y))
    area(y)(x) = false
    while (queue.nonEmpty) {
      val current = queue.dequeue()
      for (c@Coordinate(nx, ny) ← current.neighbor if area.indices.contains(ny) && area(ny).indices.contains(nx) && area(ny)(nx)) {
        area(ny)(nx) = false
        queue.enqueue(c)
      }
    }
  }
  case class Coordinate(x: Int, y: Int) {
    def neighbor: List[Coordinate] = List(Coordinate(x + 1, y), Coordinate(x - 1, y), Coordinate(x, y + 1), Coordinate(x, y - 1))
  }
}
