#include <bits/stdc++.h>
using namespace std;
static array<array<bool, 100>, 100> arr;
int main() {
  size_t n;
  cin >> n;
  unsigned long long ans = 0;
  for (size_t i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (size_t j = 0; j < n; ++j) {
      arr[i][j] = (s[j] == '.' ? 0 : 1);
    }
  }
  for (size_t i = 0; i < n; ++i) {
    unsigned long long sor = accumulate(arr[i].begin(), arr[i].begin() + n, 0);
    ans += sor * (sor - 1) / 2;
    unsigned long long oszlop = 0;
    for (size_t j = 0; j < n; ++j) oszlop += arr[j][i];
    ans += oszlop * (oszlop - 1) / 2;
  }
  cout << ans;
  return 0;
}
