#include <bits/stdc++.h>
using namespace std;
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;
  string s;
  vector<long long> v1, v2;
  for (long long i = 0; i < w; i++) {
    cin >> s;
    for (long long j = 0; j < h; j++) {
      if (s[j] == '#') {
        v1.push_back(i);
        v2.push_back(j);
      }
    }
  }
  for (long long i = 0; i < v1.size(); i++) {
    for (long long j = 0; j < v1.size(); j++) {
      if (i != j) {
        long long rast = abs(v1[i] - v1[j]) + abs(v2[i] - v2[j]);
        g[v1[i] * h + v2[i]][rast].push_back(v1[j] * h + v2[j]);
        if (j > i) y[v1[i] * h + v2[i]][rast].push_back(v1[j] * h + v2[j]);
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < v1.size(); i++) {
    long long numi = v1[i] * h + v2[i];
    for (long long j = i + 1; j < v1.size(); j++) {
      long long rast = abs(v1[i] - v1[j]) + abs(v2[i] - v2[j]);
      long long numj = v1[j] * h + v2[j];
      for (long long e = 0; e < y[numj][rast].size(); e++) {
        long long u = y[numj][rast][e];
        long long l = -1, r = g[u][rast].size();
        while (l + 1 < r) {
          long long 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;
}
