#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <complex>
#include <iomanip>
#include <random>

using namespace std;

typedef long long ll;
#define int ll

const int M = 998244353;
#define msum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define msub(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define mmult(a, b) (((a) * (b)) % M)

typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SZ(a) ((int)(a).size())
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);
const int oo = 1e9 + 100;
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


#define N 10000

vector <int> g[9000][9000], y[9000][9000];

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int w, h;
	cin >> w >> h;
	vector <string> s(w);
	vector <pair <int, int> > v;
	for (int i = 0; i < w; i++)
	{
		cin >> s[i];
		for (int j = 0; j < h; j++)
		{
			if (s[i][j] == '#')
				v.push_back({ i, j });
		}
	}
	
	for (int i = 0; i < v.size(); i++)
	{
		for (int j = 0; j < v.size(); j++)
		{
			if (i != j)
			{
				int rast = abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
				g[v[i].first * h + v[i].second][rast].push_back(v[j].first * h + v[j].second);
				if (j > i)
					y[v[i].first * h + v[i].second][rast].push_back(v[j].first * h + v[j].second);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < v.size(); i++)
	{
		int numi = v[i].first * h + v[i].second;
		for (int j = i + 1; j < v.size(); j++)
		{
			int rast = abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
			int numj = v[j].first * h + v[j].second;
			for (int h = 0; h < y[numj][rast].size(); h++)
			{
				int u = y[numj][rast][h];
				auto f = lower_bound(ALL(g[u][rast]), numi);
				if (f != g[u][rast].end() && *f == numi)
				{
					ans++;
				}
			}
		}
	}
	
	cout << ans;
}