#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

vector<int> xs[620],ys[620];

signed main(){
	int h,w,ans = 0;
	string field[310];
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		cin >> field[i];
		for(int j = 0;j < w;j++){
			if(field[i][j] == '#'){
				xs[i + j].pb(i - j + 300);
				ys[i - j + 300].pb(i + j);
			}
		}
	}
	for(int i = 0;i < 620;i++) sort(all(xs[i]));
	for(int i = 0;i < 620;i++) sort(all(ys[i]));
	for(int i = 0;i < 620;i++){
		for(int j = 0;j < xs[i].size();j++){
			for(int k = j + 1;k < xs[i].size();k++){
				if(i + xs[i][k] - xs[i][j] < 620) ans += upper_bound(all(xs[i + xs[i][k] - xs[i][j]]),xs[i][k]) - lower_bound(all(xs[i + xs[i][k] - xs[i][j]]),xs[i][j]);
				if(i - xs[i][k] + xs[i][j] >= 0) ans += upper_bound(all(xs[i - xs[i][k] + xs[i][j]]),xs[i][k]) - lower_bound(all(xs[i - xs[i][k] + xs[i][j]]),xs[i][j]);
			}
		}
	}
	for(int i = 0;i < 620;i++){
		for(int j = 0;j < ys[i].size();j++){
			for(int k = j + 1;k < ys[i].size();k++){
				if(ys[i][k] - ys[i][j] >= 2){
					if(i + ys[i][k] - ys[i][j] < 620) ans += upper_bound(all(ys[i + ys[i][k] - ys[i][j]]),ys[i][k] - 1) - lower_bound(all(ys[i + ys[i][k] - ys[i][j]]),ys[i][j] + 1);
					if(i - ys[i][k] + ys[i][j] >= 0) ans += upper_bound(all(ys[i - ys[i][k] + ys[i][j]]),ys[i][k] - 1) - lower_bound(all(ys[i - ys[i][k] + ys[i][j]]),ys[i][j] + 1);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}