The School CorridorEasy

The School Corridor

Easy+10 XP · +5 Auramatrixloops

UptoSkills Arena has a new building, and the students are exploring it. The main corridor is a rectangular grid of classrooms. Some classrooms are occupied, and some are empty. A student wants to know how many classrooms on the main corridor are occupied. Can you help them count?

The corridor is represented as a 2D grid where 'O' denotes an occupied classroom and 'E' denotes an empty classroom.

Input

The first line contains two integers N and M, representing the number of rows and columns in the grid, respectively. The next N lines each contain M characters, representing the grid.

Output

Print a single integer, the total number of occupied classrooms ('O').

Constraints

1 <= N, M <= 1000. The grid contains only 'O' and 'E' characters.

Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
3 4
EOEE
OEOE
EEEO
Output
4

There are 4 occupied classrooms ('O').

Example 2

Input
2 2
OO
OO
Output
4

All 4 classrooms are occupied.

Hints