N, M = map(int, input().split())
S = [input() for _ in range(N)]
S_ = [int("".join((map(lambda c: "1" if c == "o" else "0", s))), 2) for s in S]

cnt = 0
for i in range(N):
    for j in range(i + 1, N):
        if S_[i] | S_[j] >= (1 << M) - 1:
            cnt += 1

print(cnt)
