Door's family is going celebrate Famil Doors's birthday party. They love Famil Door so they are planning to make his birthday cake weird!

The cake is a *n* × *n* square consisting of equal squares with side length 1. Each square is either empty or consists of a single chocolate. They bought the cake and randomly started to put the chocolates on the cake. The value of Famil Door's happiness will be equal to the number of pairs of cells with chocolates that are in the same row or in the same column of the cake. Famil Doors's family is wondering what is the amount of happiness of Famil going to be?

Please, note that any pair can be counted no more than once, as two different cells can't share both the same row and the same column.
In the first line of the input, you are given a single integer *n* (1 ≤ *n* ≤ 100) — the length of the side of the cake.

Then follow *n* lines, each containing *n* characters. Empty cells are denoted with '.', while cells that contain chocolates are denoted by 'C'.
If we number rows from top to bottom and columns from left to right, then, pieces that share the same row in the first sample are: 
 1.  (1, 2) and (1, 3) 1.  (3, 1) and (3, 3)  1.  (2, 1) and (3, 1) 1.  (1, 3) and (3, 3)
3
.CC
C..
C.C
4
4
CC..
C..C
.CC.
.CC.
9
5
.CCCC
CCCCC
.CCC.
CC...
.CC.C
46
7
.CC..CC
CC.C..C
C.C..C.
C...C.C
CCC.CCC
.CC...C
.C.CCC.
84
8
..C....C
C.CCC.CC
.C..C.CC
CC......
C..C..CC
C.C...C.
C.C..C..
C...C.C.
80
9
.C...CCCC
C.CCCC...
....C..CC
.CC.CCC..
.C.C..CC.
C...C.CCC
CCC.C...C
CCCC....C
..C..C..C
144
10
..C..C.C..
..CC..C.CC
.C.C...C.C
..C.CC..CC
....C..C.C
...C..C..C
CC.CC....C
..CCCC.C.C
..CC.CCC..
CCCC..C.CC
190
11
C.CC...C.CC
CC.C....C.C
.....C..CCC
....C.CC.CC
C..C..CC...
C...C...C..
CC..CCC.C.C
..C.CC.C..C
C...C.C..CC
.C.C..CC..C
.C.C.CC.C..
228
21
...CCC.....CC..C..C.C
..CCC...CC...CC.CCC.C
....C.C.C..CCC..C.C.C
....CCC..C..C.CC.CCC.
...CCC.C..C.C.....CCC
.CCC.....CCC..C...C.C
CCCC.C...CCC.C...C.CC
C..C...C.CCC..CC..C..
C...CC..C.C.CC..C.CC.
CC..CCCCCCCCC..C....C
.C..CCCC.CCCC.CCC...C
CCC...CCC...CCC.C..C.
.CCCCCCCC.CCCC.CC.C..
.C.C..C....C.CCCCCC.C
...C...C.CCC.C.CC..C.
CCC...CC..CC...C..C.C
.CCCCC...C.C..C.CC.C.
..CCC.C.C..CCC.CCC...
..C..C.C.C.....CC.C..
.CC.C...C.CCC.C....CC
...C..CCCC.CCC....C..
2103
20
C.C.CCC.C....C.CCCCC
C.CC.C..CCC....CCCC.
.CCC.CC...CC.CCCCCC.
.C...CCCC..C....CCC.
.C..CCCCCCC.C.C.....
C....C.C..CCC.C..CCC
...C.C.CC..CC..CC...
C...CC.C.CCCCC....CC
.CC.C.CCC....C.CCC.C
CC...CC...CC..CC...C
C.C..CC.C.CCCC.C.CC.
..CCCCC.C.CCC..CCCC.
....C..C..C.CC...C.C
C..CCC..CC..C.CC..CC
...CC......C.C..C.C.
CC.CCCCC.CC.CC...C.C
.C.CC..CC..CCC.C.CCC
C..C.CC....C....C...
..CCC..CCC...CC..C.C
.C.CCC.CCCCCCCCC..CC
2071
17
CCC..C.C....C.C.C
.C.CC.CC...CC..C.
.CCCC.CC.C..CCC.C
...CCC.CC.CCC.C.C
CCCCCCCC..C.CC.CC
...C..C....C.CC.C
CC....CCC...C.CC.
.CC.C.CC..C......
.CCCCC.C.CC.CCCCC
..CCCC...C..CC..C
C.CC.C.CC..C.C.C.
C..C..C..CCC.C...
.C..CCCC..C......
.CC.C...C..CC.CC.
C..C....CC...CC..
C.CC.CC..C.C..C..
CCCC...C.C..CCCC.
1160
15
CCCC.C..CCC....
CCCCCC.CC.....C
...C.CC.C.C.CC.
CCCCCCC..C..C..
C..CCC..C.CCCC.
.CC..C.C.C.CC.C
.C.C..C..C.C..C
...C...C..CCCC.
.....C.C..CC...
CC.C.C..CC.C..C
..CCCCC..CCC...
CC.CC.C..CC.CCC
..CCC...CC.C..C
CC..C.C..CCC..C
.C.C....CCC...C
789
1
.
0
3
.CC
C..
C.C
4
13
C.C...C.C.C..
CC.CCCC.CC..C
.C.CCCCC.CC..
CCCC..C...C..
...CC.C.C...C
.CC.CCC...CC.
CC.CCCCCC....
.C...C..CC..C
CCCC.CC...C..
.C.CCC..C.CC.
..C...CC..C.C
..C.CCC..CC.C
.C...CCC.CC.C
529
16
.C.C.C.C.C...C.C
..C..C.CCCCCC...
..C.C.C.C..C..C.
.CC....C.CCC..C.
.C.CCC..C....CCC
CC..C.CC..C.C.CC
...C..C..CC..CC.
.CCC..C.CC.C.C..
.CC.C..........C
C...C....CC..C..
C.CCC.C..C..C...
.CCCCCCCCCCCC..C
..C.C.CC.CC.CCC.
CC..C.C....C..CC
C.CCC..C..C.C.CC
.C.CCC.CC..CCC.C
874
2
CC
CC
4
3
C..
C..
C..
3
n = int(input())
mat, counter = [[0] * n for i in range(n)], 0
for i in range(n):
    s = input()
    for j in range(n):
        mat[i][j] = [0, 1][s[j] == 'C']
for i in range(n):
    a, b = sum(mat[i]), sum(j[i] for j in mat)
    counter += (a * (a - 1) + b * (b - 1)) // 2
print(counter)