Peg Move Count

Time limit1sMemory limit128 MB

Problem

Peg is a puzzle game where one peg jumps over an adjacent peg and removes the jumped peg. A move always goes in exactly one of the four cardinal directions: up, down, left, or right.

A common starting board looks like this:

  ooo
  ooo
ooooooo
ooo.ooo
ooooooo
  ooo
  ooo

The character o means a cell contains a peg, . means the cell is empty, and a space means the position is not part of the board. If a peg has another peg in an adjacent cell and the next cell in the same direction is empty, the first peg may jump over the adjacent peg into that empty cell. The jumped peg would be removed.

Given the current board, count how many legal single moves are possible.

Input

The input contains 7 lines describing the current board. Corner cells that are not part of the board are written as spaces. Every other cell is either o or ..

Output

Print the number of legal moves.