A higher resolution is required to access the IDE

- 33

## Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

## Statement

## Goal

**Determine how many dominoes will still stand after the push.**

We have a field of standing domino pieces, and we will push the top left corner piece. After the chain reaction, how many domino pieces will still be standing?

You receive a square shape map of characters, with

`N`lines, and

`N`characters in every line.

The characters represent visually the domino pieces and their direction.

You can find these characters:

"

"

"

"

"

The pieces will fall to the opposite direction to the direction they were hit from, and will hit other domino pieces from that direction.

We always hit the first domino on the top left corner, which can be either a vertical standing (falls to the right), horizontal standing (falls downwards), or a "

I didn't add any other difficulties to the examples, for example order doesn't matter, because the answers will be the same. This is changed in the second version.

**Example explanation:**

- We push the first piece which will fall to the right, hitting the second piece, which is a "

- This will hit three locations: downwards an empty place, to the right a vertical one ("

- The other vertical piece will hit the last piece in the first row, which is a diagonal, and will hit the one downwards to it.

- This piece is horizontal, and will fall downwards, hitting the diagonal piece there.

- The diagonal piece will hit an empty place to the left, a diagonal piece downwards, and a vertical one left-downwards.

- The diagonal piece will hit nothing new, but the same vertical piece.

- And in the last line, the vertical pieces will hit each other falling to the left.

Input

**Line 1:**An integer

`N`for the length of one side of the domino map.

**Next**

`N`lines:`N`space-separated characters.

Output

**Line 1:**The number of pieces standing after the chain reaction.

Constraints

0 <

`N`≤ 10Example

Input

4 | / | / - . | - | | . \ | | | \

Output

3

A higher resolution is required to access the IDE

Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!

JOIN US ON DISCORD Online Participants