#include <bits/stdc++.h>
using namespace std;
int stris(char** mas, int n) {
  int one = 0;
  int two = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (mas[i][j] != '.') {
        ++one;
      }
    }
    if (one >= 2) {
      two += one * (one - 1) / 2;
    }
    one = 0;
  }
  return two;
}
int columns(char** mas, int n) {
  int one1 = 0;
  int two1 = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (mas[j][i] != '.') {
        ++one1;
      }
    }
    if (one1 >= 2) {
      two1 += one1 * (one1 - 1) / 2;
    }
    one1 = 0;
  }
  return two1;
}
int main() {
  int n;
  cin >> n;
  char ch;
  char** mas;
  mas = new char*[n];
  for (int i = 0; i < n; ++i) {
    mas[i] = new char[n];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> mas[i][j];
    }
  }
  int first = stris(mas, n);
  int second = columns(mas, n);
  cout << first + second;
  return 0;
}
