#include <bits/stdc++.h>
using namespace std;
int dist(pair<int, int> p, pair<int, int> q) {
  return abs(p.first - q.first) + abs(p.second - q.second);
}
int main(int argc, char** argv) {
  if (argc == 2 && atoi(argv[1]) == 123456789)
    freopen("d:\\code\\cpp\\stdin", "r", stdin);
  int h, w;
  scanf("%d%d", &h, &w);
  vector<pair<int, int>> pts;
  char row[400];
  for (int i = 0; i < h; i++) {
    scanf("%s", row);
    for (int j = 0; j < w; j++)
      if (row[j] == '#') pts.push_back(make_pair(i, j));
  }
  map<int, set<pair<int, int>>> H;
  for (int i = 0; i < pts.size(); i++) {
    for (int j = i + 1; j < pts.size(); j++) {
      H[dist(pts[i], pts[j])].insert(make_pair(i, j));
    }
  }
  long long sol = 0;
  for (auto it : H) {
    vector<set<int>> edges(pts.size());
    for (auto pp : it.second) {
      for (int k = 0; k < pts.size(); k++)
        if (k != pp.first && k != pp.second) {
          auto p1 = make_pair(min(k, pp.first), max(k, pp.first));
          auto p2 = make_pair(min(k, pp.second), max(k, pp.second));
          if (it.second.find(p1) != it.second.end() &&
              it.second.find(p2) != it.second.end())
            sol++;
        }
    }
  }
  cout << sol / 3;
  return 0;
}
