#include <bits/stdc++.h>
using namespace std;
char str[105][105];
int main() {
  int n, res = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
  }
  for (int i = 0; i < n; i++) {
    int temp = 0;
    for (int j = 0; j < n; j++) {
      if (str[i][j] != '.') temp++;
    }
    res += temp * (temp - 1) / 2;
  }
  for (int i = 0; i < n; i++) {
    int temp = 0;
    for (int j = 0; j < n; j++) {
      if (str[j][i] != '.') temp++;
    }
    res += temp * (temp - 1) / 2;
  }
  cout << res << endl;
}
