#include <bits/stdc++.h>
using namespace std;
int n;
char mat[355][355];
int g[655][655];
const int B = 300;
int sum(int i, int l, int r) { return g[i][r] - (l > 0 ? g[i][l - 1] : 0); }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%s", mat[i]);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (mat[i][j] == '#') {
        g[i + j][i - j + B]++;
      }
    }
  for (int i = 0; i <= 600; i++)
    for (int j = 1; j <= 600; j++) {
      g[i][j] += g[i][j - 1];
    }
  long long res = 0;
  for (int maxDist = 1; maxDist <= 600; maxDist++) {
    for (int startX = 0; startX + maxDist <= 600; startX++) {
      int endX = startX + maxDist;
      for (int lowY = 0; lowY + maxDist <= 600; lowY++) {
        res += 1ll * sum(startX, lowY, lowY) *
               sum(startX, lowY + maxDist, lowY + maxDist) *
               sum(endX, lowY, lowY + maxDist);
        res += 1ll * sum(endX, lowY, lowY) *
               sum(endX, lowY + maxDist, lowY + maxDist) *
               sum(startX, lowY, lowY + maxDist);
      }
    }
  }
  printf("%lld\n", res);
}
