Seat War

Time limit1sMemory limit128 MB

Problem

Inside a train car of size $R \times C$ you are given the layout of seats and people. People strongly dislike standing, so whenever they see an empty seat they will always try to sit in it.

However, for a given seat, if there is someone closer to that seat than you are, you yield, because you know that person will sit down first.

If no one is closer to the seat than you, but there is someone at exactly the same distance as you, then the two of you fight over the seat. A seat where such a fight breaks out is called a battlefield. (Everyone is confident in a fight, so no one avoids these battlefields.)

Given the layout of the train car, count the number of seats that become battlefields.

The distance $\text{Dist}$ between two cells $(A, B)$ and $(C, D)$ is the Euclidean distance, which satisfies

$$\text{Dist}^2 = (A - C)^2 + (B - D)^2$$

Input

The first line contains two integers $R$ and $C$. ($1 \le R \le 100$, $1 \le C \le 100$)

Each of the next $R$ lines contains $C$ characters. Every character is guaranteed to be one of . (empty space), X (a person), or L (a seat).

At least one X and at least one L are guaranteed to appear. It is also guaranteed that no single X has two or more L at the same distance from it.

Output

Print, on a single line, the number of seats that become battlefields.