#include <bits/stdc++.h>
using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


LL acc[700][700];

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

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

  int H, W;
  cin >> H >> W;

  VS vs(H);
  cin >> vs;
  int bias = 0;
  int HH = 0, WW = -1e9;
  REP(y,H) REP(x,W){
	if(vs[y][x] == '#'){
	  maxi(HH, x+y);
	  maxi(WW, x-y);
	  mini(bias, x-y);
	}
  }

  if(WW == -1e9){
	cout << 0 << endl;
	return 0;
  }

  HH = HH+1;
  WW = WW-bias+1;
  VS vs2(HH, string(WW-bias, '.'));
  REP(y,H) REP(x,W){
	if(vs[y][x] == '#'){
	  vs2[x+y][x-y-bias] = '#';
	}
  }

#ifdef PYONPOI
  for(auto& s:vs2){
	cerr << s << endl;
  }
#endif

  REP(y,HH) REP(x,WW){
	acc[y+1][x+1] = acc[y+1][x] + acc[y][x+1] - acc[y][x] + (vs2[y][x] == '#'?1:0);
  }
  /*
  REP(y,HH+1){ REP(x,WW+1){
	cout<<acc[y][x]<<" ";
	}cout<<endl;
}
  */

  auto sum = [&](int x1, int y1, int x2, int y2){
	x1 = min(WW, max(x1, 0));
	x2 = min(WW, max(x2, 0));
	y1 = min(HH, max(y1, 0));
	y2 = min(HH, max(y2, 0));
	/*
	maxi(y1, 0);
	mini(x2, WW);
	mini(y2, HH);
	*/
	return acc[y2][x2] - acc[y1][x2] - acc[y2][x1] + acc[y1][x1];
  };
  auto isin = [HH,WW](int x, int y){
	return 0 <= y && y < HH && 0 <= x && x < WW;
  };

  LL ans = 0;
  const int MAX = min(HH+1, WW+1);
  REP(y,HH) REP(x,WW){
	if(vs2[y][x] == '#'){
	  FOR(d,1,MAX){
		REP(dir,2){
		  int tx = x + dx[dir]*d;
		  int ty = y + dy[dir]*d;
		  if(!isin(tx,ty) || vs2[ty][tx] == '.') continue;
		  LL tmp = 0;
		  if(y == ty){
			tmp += sum(min(tx,x), y+d, max(tx,x)+1, y+d+1);
			tmp += sum(min(tx,x), y-d, max(tx,x)+1, y-d+1);
			tmp -= sum(max(tx,x), y+d, max(tx,x)+1, y+d+1);
			tmp -= sum(max(tx,x), y-d, max(tx,x)+1, y-d+1);
			tmp -= sum(min(tx,x), y+d, min(tx,x)+1, y+d+1);
			tmp -= sum(min(tx,x), y-d, min(tx,x)+1, y-d+1);
		  }
		  else{
			tmp += sum(x+d, min(ty,y), x+d+1, max(ty,y)+1);
			tmp += sum(x-d, min(ty,y), x-d+1, max(ty,y)+1);
		  }
		  //cout<<x<<","<<y<<" - " <<tx<<","<<ty<<"->"<<tmp<<endl;
		  ans += tmp;
		}
	  }
	}
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4352