#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int sz;
int solve(vector<int> &A, vector<int> &B, int o) {
	int N = A.size();
	set<pair<int, int> > st;
	vector<vector<int> > Xs(sz);
	int res = 0;
	for (int i = 0; i < N; i++) {
		Xs[A[i] + B[i]].push_back(A[i] - B[i]);
		st.emplace(A[i] + B[i], A[i] - B[i]);
	}
	for (int i = 0; i < Xs.size(); i++) {
		sort(Xs[i].begin(), Xs[i].end());
	}
	int m, x;
	int d;
	for (int i = 0; i < Xs.size(); i++) {
		for (int j = 0; j < Xs[i].size(); j++) {
			for (int k = 0; k < j; k++) {
				m = (Xs[i][j] - Xs[i][k]);
				for (int t = -1; t <= 1; t += 2) {
					x = i + t*m;
					if (x >= 0 && x < Xs.size()) {
						
						res += upper_bound(Xs[x].begin(), Xs[x].end(), Xs[i][j] - o)
							- lower_bound(Xs[x].begin(), Xs[x].end(), Xs[i][k] + o);
					/*	d = upper_bound(Xs[x].begin(), Xs[x].end(), Xs[i][j] - o)
							- lower_bound(Xs[x].begin(), Xs[x].end(), Xs[i][k] + o);
						if (d > 0) {
							cerr << (i + Xs[i][j]) / 2 << " " << (i - Xs[i][j]) / 2 << endl;
							cerr << (i + Xs[i][k]) / 2 << " " << (i - Xs[i][k]) / 2 << endl;
						}*/
					}
				}
			}
		}
	}
	return res;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	sz = H + W - 1;
	vector<string> S(H);
	int res = 0;
	vector<int> X;
	vector<int> Y;
	for (int i = 0; i < H; i++) {
		cin >> S[i];
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				X.push_back(i);
				Y.push_back(j);
			}
		}
	}
	res = solve(X, Y, 0);
	//cerr << res << endl;
	for (int i = 0; i < X.size(); i++)(X[i] = H - 1 - X[i]);
	res += solve(X, Y, 1);
	cout << res << endl;
}