#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



bool coin[600][600];
int sx[600][601];
int sy[600][601];



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

	int h, w;
	cin >> h >> w;
	rep(i,h)rep(j,w) {
		char c;
		cin >> c;
		if (c=='#') {
			int y = i - j + w - 1;
			int x = i + j;
			coin[y][x] = true;
			sx[x][y+1]++;
			sy[y][x+1]++;
		}
	}

	rep(x, h+w)rep(y, h+w)sx[x][y + 1] += sx[x][y];
	rep(y, h+w)rep(x, h+w)sy[y][x + 1] += sy[y][x];



	long long ans1 = 0, ans2 = 0;
	rep(y, h+w)rep(x,h+w)if(coin[y][x]) {
		rep(y2, h+w) if (y != y2 && coin[y2][x]) {
			int ymi = min(y, y2), yma = max(y, y2);
			int d = yma - ymi;
			if (x - d >= 0) {
				ans1 += sx[x - d][yma] - sx[x - d][ymi+1];
				if (coin[y][x - d])ans2++;
				if (coin[y2][x - d])ans2++;
			}
			if (x+d < 600) {
				ans1 += sx[x + d][yma] - sx[x + d][ymi+1];
				if (coin[y][x + d])ans2++;
				if (coin[y2][x + d])ans2++;
			}
		}
		rep(x2, h+w) if (x != x2 && coin[y][x2]) {
			int xmi = min(x, x2), xma = max(x, x2);
			int d = xma - xmi;
			if (y - d >= 0) {
				ans1 += sy[y - d][xma] - sy[y - d][xmi+1];
				if (coin[y - d][x])ans2++;
				if (coin[y - d][x2])ans2++;
			}
			if (y + d < 600) {
				ans1 += sy[y + d][xma] - sy[y + d][xmi+1];
				if (coin[y + d][x])ans2++;
				if (coin[y + d][x2])ans2++;
			}
		}
	}

	cout << ans1/2 + ans2/4 << endl;


	return 0;
}