There are `N`

students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature, i.e., if `A`

is friend of `B`

and `B`

is friend of `C`

, then `A`

is also friend of `C`

. A friend circle is a group of students who are directly or indirectly friends.

You are given a `N×N − matrix M`

which consists of characters `Y`

or `N`

. If `M[i][j]=Y`

, then `ith`

and `jth`

students are friends with each other, otherwise not. You have to print the total number of friend circles in the class.

Each element of matrix friends will be Y or N.

Number of rows and columns will be equal in the matrix.

`M[i][i]=Y`

, where `0≤i<N0≤i<N`

`M[i][j] = M[j][i]`

, where `0≤i<j<N`

Example 1

Input:

YYNN

YYYN

NYYN

NNNY

Output: 2

Example 2

Input

YNNNN

NYNNN

NNYNN

NNNYN

NNNNY

Output: 5