#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int h, w;
string tmp[300];
char s[666][666];
int N;
int imosR[1444][1444];
int imosC[1444][1444];

signed main() {
	int i, j;
	
	cin >> h >> w;
	rep(i, h) cin >> tmp[i];
	
	rep(i, h) {
		rep(j, w) {
			int i2 = i + j;
			int j2 = i - j + w - 1;
			s[i2][j2] = tmp[i][j];
		}
	}
	N = h + w - 1;
	
	//デバッグ
	/*cout << endl;
	rep(i, N) {
		rep(j, N) {
			if (s[i][j] == '#') cout << s[i][j];
			else cout << ".";
		}
		cout << endl;
	}*/
	
	//#の数を累積和する
	rep(i, N) {
		rep(j, N) {
			if (s[i][j] == '#') imosR[i][j + 1]++;
		}
		rep(j, 2 * N + 100) { imosR[i][j + 1] += imosR[i][j]; }
	}
	
	rep(j, N) {
		rep(i, N) {
			if (s[i][j] == '#') imosC[i + 1][j]++;
		}
		rep(i, 2 * N + 100) { imosC[i + 1][j] += imosC[i][j]; }
	}
	
	//2点間の距離dを全探索
	int ans = 0;
	for (int d = 1; d < N; d++) {
		rep(i, N) {
			rep(j, N) {
				if (s[i][j] != '#') continue;
				if (j + d >= N || s[i][j + d] != '#') continue;
				//cout << i << ", " << j << endl;
				//cout << i << ", " << j + d << endl;
				//cout << endl;
				
				ans += imosR[i + d][j + d + 1] - imosR[i + d][j];
				if (i >= d) ans += imosR[i - d][j + d + 1] - imosR[i - d][j];
			}
		}
	}
	
	//全探索その2
	for (int d = 1; d < N; d++) {
		rep(i, N) {
			rep(j, N) {
				if (s[i][j] != '#') continue;
				if (i + d >= N || s[i + d][j] != '#') continue;
				ans += imosC[i + d + 1][j + d] - imosC[i][j + d];
				if (j >= d) ans += imosC[i + d + 1][j - d] - imosC[i][j - d];
			}
		}
	}
	
	//積集合を取り除く1
	for (int d = 1; d < N; d++) {
		rep(i, N) {
			rep(j, N) {
				if (s[i][j] != '#') continue;
				if (j + d >= N || s[i][j + d] != '#') continue;
				//cout << i << ", " << j << endl;a
				//cout << i << ", " << j + d << endl;
				//cout << endl;
				
				ans -= imosR[i + d][j + d + 1] - imosR[i + d][j + d];
				ans -= imosR[i + d][j + 1] - imosR[i + d][j];
				if (i >= d) ans -= imosR[i - d][j + d + 1] - imosR[i - d][j + d];
				if (i >= d) ans -= imosR[i - d][j + 1] - imosR[i - d][j];
			}
		}
	}
	cout << ans << endl;
	return 0;
}