 #include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <set>
 #include <map>
 #include <vector>
 #include <list>
 #include <algorithm>
 #include <cstring>
 #include <cmath>
 #include <string>
 #include <queue>
 #include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
 #include <cassert>
 #include <iomanip>        //do setprecision
 #include <ctime>
 #include <complex>
 using namespace std;

 #define FOR(i,b,e) for(int i=(b);i<(e);++i)
 #define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
 #define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
 #define REP(x, n) for(int x = 0; x < (n); ++x)

 #define ST first
 #define ND second
 #define PB push_back
 #define PF push_front
 #define MP make_pair
 #define LL long long
 #define ULL unsigned LL
 #define LD long double
 #define pii pair<int,int>
 #define pll pair<LL,LL>

 const double pi = 3.14159265358979323846264;
 const int mod=1000000007;
 int H,W;

mh(int a,int b, int c, int d){
	return abs(a-c)+abs(b-d);
}
in(int a,int b){
	return ((0<=a&&a<H)&&(0<=b&&b<W));
}

int main(){
	int h,w;
	cin>>h>>w;
	H=h,W=w;
	vector<vector<int>> b=vector<vector<int>>(h+1,vector<int>(w+1,0));
	FOR(i,0,h){
		FOR(j,0,w){
			char c;
			cin>>c;
			if(c=='#')b[i][j]=1;
		}
	}
	LL ans=0;
	FOR(i,0,h){
		FOR(j,0,w){
			FOR(k,1,300){
				int f=0;
				FOR(t,0,4){
					int x[2]={},y[2]={};
					if(t==0){
						x[0]=i+2*k;
						y[0]=j;
						x[1]=i+1*k;
						y[1]=j+1*k;
					}
					if(t==1){
						x[0]=i+2*k;
						y[0]=j;
						x[1]=i+1*k;
						y[1]=j-1*k;
					}
					if(t==2){
						x[0]=i+1*k;
						y[0]=j+1*k;
						x[1]=i+1*k;
						y[1]=j-1*k;
					}
					if(t==3){
						x[0]=i+1*k;
						y[0]=j+1*k;
						x[1]=i;
						y[1]=j+2*k;
					}
					int f2=1;
					FOR(ii,0,2){
						if(!in(x[ii],y[ii])||b[x[ii]][y[ii]]==0)f2=0;
					}
					if(f2==0)continue;
					//cerr<<i<<" "<<j<<" "<<k<<" "<<t<<" "<<endl;
					ans++;
					f++;
				}

				if(f==0)break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
