Go

Place black stones to capture dead white stones, where a white stone dies when all its empty neighbors are filled, and maximize the final count of empty cells.

Medium6GraphGreedyImplementationBrute forceNo attempts yetTime limit2sMemory limit512 MB

Problem

Minho and Kangho are playing Go. Minho took the black stones and Kangho took the white stones.

Right now no two white stones on the board are adjacent. Kangho has already resigned, so he cannot place any more stones. Minho can still place stones, and he wants the board to end up with as many empty cells as possible.

Minho may put a black stone on an empty cell. After he puts stones down, every dead white stone is removed from the board. A white stone is dead when none of the cells adjacent to it is empty. Two cells are adjacent when they share an edge.

Given the state of the board, write a program that finds the largest number of empty cells Minho can make.

Input

The first line contains N, the width and the height of the board. (3 ≤ N ≤ 50)

Each of the next N lines contains N characters describing the board. Each character is one of the following three.

  • 'o': a white stone
  • 'x': a black stone
  • '.': an empty cell

No two white stones are adjacent, and every white stone is adjacent to at least one empty cell.

Output

Print the largest number of empty cells Minho can make.

Hint

Every black stone Minho places removes one empty cell, and every white stone removed from the board adds one. To capture a white stone, all of the empty cells adjacent to it must be filled with black stones. No two white stones are adjacent, so an empty cell left behind by a removed white stone never saves another white stone. Minho may also place no stone at all.