#include <bits/stdc++.h>
using namespace std;
#define ALL(c) (c).begin(),(c).end()

const int O = 400;
const int M = 1000;

int f1[1000][1000], f2[1000][1000];

void solve(long long H, long long W, vector<string> s){
	map<int, vector<pair<int, int>>> mpx, mpy;
	for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) {
		if (s[i][j] == '.') continue;
		int x = i + j + O / 2, y = i - j + O;
		mpx[x].push_back(make_pair(x,y));
		mpy[y].push_back(make_pair(x,y));
		f1[x][y] = f2[x][y] = 1;
	}
	for(int i = 0; i < M; ++i) {
		for(int j = 1; j < M; ++j) {
			f1[i][j] += f1[i][j-1];
		}
	}
	for(int i = 1; i < M; ++i) {
		for(int j = 0; j < M; ++j) {
			f2[i][j] += f2[i-1][j];
		}
	}

	int res = 0;
	for(auto p: mpx) {
		vector<pair<int,int>> v = p.second;
		for(int i = 0; i < v.size(); ++i) for(int j = i + 1; j < v.size(); ++j) {
			auto a = v[i];
			auto b = v[j];
			int y1 = min(a.second, b.second), y2 = max(a.second, b.second);
			int d = y2 - y1; 
			if(a.first - d >= 0) {
				res += f1[a.first - d][y2] - f1[a.first - d][y1 - 1];
				res -= f1[a.first - d][y1] - f1[a.first - d][y1 - 1];
				res -= f1[a.first - d][y2] - f1[a.first - d][y2 - 1];
			}

			if(a.first + d < M) {
				res += f1[a.first + d][y2] - f1[a.first + d][y1 - 1];
				res -= f1[a.first+d][y1] - f1[a.first + d][y1 - 1];
				res -= f1[a.first+d][y2] - f1[a.first + d][y2 - 1];
			}
		}
	}
	for(auto p: mpy) {
		vector<pair<int,int>> v = p.second;
		for(int i = 0; i < v.size(); ++i) for(int j = i + 1; j < v.size(); ++j) {
			auto a = v[i];
			auto b = v[j];
			int d = abs(a.first - b.first);
			int x1 = min(a.first, b.first), x2 = max(a.first, b.first);
			if(a.second - d >= 0) {
				res += max(f2[x2][a.second - d] - f2[x1 - 1][a.second - d], 0);
			}
			if(a.second + d < M) {
				res += max(f2[x2][a.second + d] - f2[x1 - 1][a.second + d], 0);
			}
		}
	}
	cout << res << endl;
}

int main(){	
	long long W;
	long long H;
	scanf("%lld",&H);
	vector<string> s(H-1+1);
	scanf("%lld",&W);
	for(int i = 0 ; i <= H-1 ; i++){
		cin >> s[i];
	}
	solve(H, W, s);
	return 0;
}

