#K86862. Maximum Guest Seating Arrangement

    ID: 36959 Type: Default 1000ms 256MiB

Maximum Guest Seating Arrangement

Maximum Guest Seating Arrangement

You are given a seating arrangement in the form of a grid with N rows. Each cell of the grid is either a reserved seat denoted by R or an available seat denoted by .. Your task is to determine the maximum number of guests that can be seated such that no two guests are adjacent in any of the eight directions (horizontally, vertically, or diagonally).

Formally, if a guest is seated at cell \((i,j)\) and another at cell \((k, \ell)\), they must satisfy either

ik>1orj>1,|i-k| > 1 \quad \text{or} \quad |j-\ell| > 1,

so that they are not neighbors.

Note: The guests can only be placed on available seats (cells containing .), and reserved seats (R) must be left empty.

inputFormat

The input is read from stdin and has the following format:

  1. An integer N representing the number of rows in the seating arrangement.
  2. N lines follow, each containing a string. Each string represents a row in the seating grid. The characters in the string will be either R (reserved) or . (available).

outputFormat

Output a single integer on stdout which is the maximum number of guests that can be placed in the seating arrangement under the given constraints.

## sample
1
.
1

</p>