#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


#define ALL(a) a.begin(),a.end()


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;
	string s;
	vector <pair <int, int> > v;
	for (int i = 0; i < w; i++)
	{
		cin >> s;
		for (int j = 0; j < h; j++)
		{
			if (s[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 e = 0; e < y[numj][rast].size(); e++)
			{
				int u = y[numj][rast][e];
				int l = -1, r = g[u][rast].size();
				while (l + 1 < r)
				{
					int m = l + r >> 1;
					if (g[u][rast][m] < numi)
						l = m;
					else
						r = m;
				}
				if (r != g[u][rast].size() && g[u][rast][r] == numi)
					ans++;
			}
		}
	}
	
	cout << ans;
	return 0;
}