#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long inf = 1ll << 62;
typedef pair<int, int> P;
typedef pair<P, int> PP;
int sum[605][605];
int rwa[605][605];

int query(int ai, int aj, int bi, int bj) {//ai+1~ai
	return rwa[bi][bj] + rwa[ai][aj] - rwa[ai][bj] - rwa[bi][aj];
}

signed main() {
	int h, w; cin >> h >> w;
	rep(i, h) {
		string s; cin >> s;
		rep(j, w) {
			if (s[j] == '#') {
				sum[i + j][i - j+w]++;
			}
		}
	}
	rep(i, h + w) {
		rep(j, h + w) {
			rwa[i + 1][j + 1] += sum[i][j];
		}
	}
	rep(i, 603)rep(j, 603)rwa[i + 1][j] += rwa[i][j];
	rep(i, 603)rep(j, 603)rwa[i][j + 1] += rwa[i][j];

	int cnt = 0;
	rep(i, h + w) {
		vector<int>V;
		rep(j, h + w) {
			if (sum[i][j])V.push_back(j);
		}
		rep(j, V.size()) {
			for (int k = j + 1; k < V.size(); k++) {
				int l = V[j], r = V[k];
				if (i - r + l >= 0)cnt += query(i - r + l, l, i - r + l + 1, r + 1);
				if (i + r - l <= h + w)cnt += query(i + r - l, l, i + r - l + 1, r + 1);
			}
		}
	}

	rep(j, h + w) {
		vector<int>V;
		rep(i, h + w) {
			if (sum[i][j])V.push_back(i);
		}
		rep(i, V.size()) {
			for (int k = i + 1; k < V.size(); k++) {
				int u = V[i], d = V[k];
				if (j - d + u >= 0)cnt += query(u+1, j - d + u, d, j - d + u + 1);
				if (j + d - u <= h + w)cnt += query(u + 1, j + d - u, d, j + d - u + 1);
			}
		}
	}
	cout <<cnt << endl;
}
