#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

static int table[300][600][301];

ll solve(vector<string> field){
	const int n = field.size(), m = field[0].size();
	for(int i = 0; i < n; ++i){ field[i] += string(n, '.'); }
	const int max_k = min(n, m);
	for(int k = 0; k < max_k; ++k){
		for(int x = 0; x < n + m; ++x){
			for(int y = 0; y < n; ++y){ table[k][x][y] = 0; }
		}
	}
	for(int k = 0; k < max_k; ++k){
		for(int x = 0; x < n + m; ++x){
			for(int y = 0; y < n; ++y){
				const int i0 = y, i1 = y + k;
				const int j0 = x - i0, j1 = x - i1;
				if(i1 >= n || j1 < 0){ continue; }
				if(field[i0][j0] != '#'){ continue; }
				if(field[i1][j1] != '#'){ continue; }
				table[k][x][y] += 1;
			}
		}
	}
	for(int k = 0; k < max_k; ++k){
		for(int x = 0; x < n + m; ++x){
			int acc = 0;
			for(int i = 0; i < n; ++i){
				const int t = table[k][x][i];
				table[k][x][i] = acc;
				acc += t;
			}
			table[k][x][n] = acc;
		}
	}
	ll answer = 0;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			if(field[i][j] != '#'){ continue; }
			for(int k = 0; k < max_k; ++k){
				const int y = i, x = j + i + k * 2;
				if(x >= n + m){ continue; }
				answer += table[k][x][min(n, i + k)];
				answer -= table[k][x][y];
			}
		}
	}
	return answer;
}

vector<string> rotate(const vector<string>& a){
	const int n = a.size(), m = a[0].size();
	vector<string> b(m, string(n, ' '));
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			b[j][i] = a[i][m - 1 - j];
		}
	}
	return b;
}

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<string> field(n);
	for(int i = 0; i < n; ++i){ cin >> field[i]; }
	ll answer = 0;
	answer += solve(field);
	field = rotate(field);
	answer += solve(field);
	field = rotate(field);
	answer += solve(field);
	field = rotate(field);
	answer += solve(field);
	cout << answer << endl;
	return 0;
}

