#include <bits/stdc++.h>
using namespace std;
const long long M = 998244353;
const double PI = 2 * acos(0.0);
const long long oo = 1e9 + 100;
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";
vector<long long> g[900][900], y[900][900];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long w, h;
  cin >> w >> h;
  vector<string> s(w);
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < w; i++) {
    cin >> s[i];
    for (long long j = 0; j < h; j++) {
      if (s[i][j] == '#') v.push_back({i, j});
    }
  }
  for (long long i = 0; i < v.size(); i++) {
    for (long long j = 0; j < v.size(); j++) {
      if (i != j) {
        long long 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);
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < v.size(); i++) {
    long long numi = v[i].first * h + v[i].second;
    for (long long j = i + 1; j < v.size(); j++) {
      long long rast =
          abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
      long long numj = v[j].first * h + v[j].second;
      for (long long e = 0; e < y[numj][rast].size(); e++) {
        long long u = y[numj][rast][e];
        auto f = lower_bound(g[u][rast].begin(), g[u][rast].end(), numi);
        if (f != g[u][rast].end() && *f == numi) {
          ans++;
        }
      }
    }
  }
  cout << ans;
  return 0;
}
