#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;



signed main(){
	int H, W;
	cin >> H >> W;
	vector<string>s(H);
	cin >> s;
	auto f = [&]() {
		vector<vector<int>>dp(660, vector<int>(660));
		vector<vector<int>>d(660, vector<int>(660));
		int mid = 330;
		REP(i, H) {
			REP(j, W) {
				if(s[i][j] == '#') {
					//dp[i + j][i - j + mid]++;
					d[i + j][i - j + mid]++;
				}
			}
		}
		REP(i, 660) {
			REP(j, 659) {
				dp[i][j + 1] += dp[i][j] + d[i][j];
			}
		}
		int ans = 0;
		int triple = 0;
		REP(i, 660) {
			REP(j, 660) {
				FOR(k, j + 1, 660) {
					if(d[i][j] && d[i][k]) {
						int diff = abs(j - k);
						if(diff % 2) continue;
						//out(i, j, k);
						if(i - diff >= 0) {
							ans += dp[i - diff][k + 1] - dp[i - diff][j];
							triple += d[i - diff][k] + d[i - diff][j];
						}
						if(i + diff < 660) {
							ans += dp[i + diff][k + 1] - dp[i + diff][j];
							triple += d[i + diff][k] + d[i + diff][j];
						}
					}
				}
			}
		}
		return make_pair(ans, triple);
	};

	int ans = 0, triples = 0;
	REP(_, 2) {
		auto[val, triple] = f();
		ans += val;
		triples += triple;
		vector<string>tmp(W);
		REP(j, W) {
			RREP(i, H) tmp[j] += s[i][j];
		}
		swap(H, W);
		s = tmp;
	}
	out(ans - triples / 2);
}