#ifndef LOCAL
#define NDEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

using i64 = int64_t;

void setIO(string s) {
	freopen((s+".in").c_str(), "r", stdin);
	freopen((s+".out").c_str(), "w", stdout);
}

const int MAXN = 310;
int N;
char G[MAXN][MAXN];

bool isGood(int x, int y) {
	return 0 <= x && x < N && 0 <= y && y < N && G[x][y] == '*';
}

i64 ans = 0;
void go() {
	for (int a = 0; a < 2*N-1; a++) {
		int st = max(0, a-N+1), en = min(a, N-1); // inclusive

		for (int b = a+2, d = 1; b < 2*N-1; b += 2, d += 1) {
			int curVal = 0;
			for (int x = 1, y = b-a-1; x <= y; x++, y--) {
				curVal += isGood(st+x, (a-st)+y) && isGood(st+x+d, (a-st)+y-d);
			}
			for (int i = st; i <= en; i++) {
				assert(0 <= i && i < N);
				assert(0 <= a-i && a-i < N);
				if (G[i][a-i] == '*') ans += curVal;
				curVal -= isGood(i+1, b-(i+1)) && isGood(i+1+d, b-(i+1+d));
				curVal += isGood(i+1+d, b-(i+1+d)) && isGood(i+1+d+d, b-(i+1+d+d));
			}
		}
	}
}

char tmp[MAXN][MAXN];

void rot90() {
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			tmp[N-1-j][i] = G[i][j];
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			G[i][j] = tmp[i][j];
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> G[i];
	}

	for (int z = 0; z < 4; z++) {
		go();
		rot90();
	}
	cout << ans << '\n';

	return 0;
}
