#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

int dx[4] = { 0,0,1,-1 };
int dy[4] = { 1,-1,0,0 };


int A[620][620],cum[620][620];
string S[303];
int H, W,N,ret;
void solve() {
	//横方向に累積和をとる
	REP(i, N) {
		cum[i][0] = 0;
		REP(j, N) {
			cum[i][j + 1] = cum[i][j] + A[i][j];
		}
	}

	//横方向で二点を固定する
	REP(x, N) {
		REP(y, N) {
			if (A[x][y] == 0)continue;
			FOR(y2, y + 1, N) {
				if (A[x][y2] == 0)continue;
				int d = y2 - y;
				if (x + d < N) {
					ret += cum[x+d][y2] - cum[x+d][y];
				}
			}
		}
	}
}
int A2[620][620];
//90度回転
void rot() {
	REP(i, N) {
		REP(j, N) {
			A2[i][j] = A[j][N - 1 - i];
		}
	}
	REP(i, N) {
		REP(j, N) {
			A[i][j] = A2[i][j];
		}
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> H >> W;
	REP(i, H) {
		cin >> S[i];
	}
	REP(i, H) {
		REP(j, W) {
			if (S[i][j] == '#') {
				int x = i + j;
				int y = i - j - 1 + W;
				A[x][y] = 1;
			}
		}
	}
	N = H + W;
	/*REP(i, N) {
		REP(j, N) {
			pe(A[i][j]);
		}cout << endl;
	}*/

	ret = 0;
	solve(); rot();
	solve(); rot();
	solve(); rot();
	solve();
	print(ret);
}
