#include <bits/stdc++.h>
using namespace std;

long long h, w;
vector<string> s;

long long solve();

int main() {
  cin >> h >> w;
  s.resize(h);
  for (auto& p : s) cin >> p;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long res = 0;
  auto calc = [](bool ch) {
    long long res = 0;
    vector<vector<int>> sum(h, vector<int>(w, 0));
    using P = pair<int, int>;
    vector<vector<P>> points(h + w);
    for (int i = 0; i < h; ++i)
      for (int j = 0; j < w; ++j) {
        if (i && j) sum[i][j] += sum[i - 1][j - 1];
        if (s[i][j] == '#') {
          ++sum[i][j];
          points[i - j + w].emplace_back(i, j);
        }
      }
    for (auto v : points) {
      int len = v.size();
      for (int i = 0; i < len; ++i)
        for (int j = i + 1; j < len; ++j) {
          P a = v[i], b = v[j];
          int dif = b.first - a.first;
          assert(dif == b.second - a.second);
          auto calcsec = [&](P c, P d) {
            long long res = 0;
            int now = max({0LL, d.first - (h - 1), d.second - (w - 1)});
            d.first -= now, d.second -= now;
            if (d.first < 0 || d.second < 0 || c.first >= h || c.second >= w)
              return 0LL;
            res += sum[d.first][d.second];
            if (c.first >= 0 && c.second >= 0) res -= sum[c.first][c.second];
            return res;
          };
          // down
          P d(a.first + 2 * dif - ch, a.second - ch),
              c(b.first - 1 + ch, b.second - 2 * dif - 1 + ch);
          res += calcsec(c, d);
          // up
          d = P(a.first - ch, a.second + 2 * dif - ch);
          c = P(b.first - 2 * dif - 1 + ch, b.second - 1 + ch);
          res += calcsec(c, d);
        }
    }
    return res;
  };
  res += calc(0);
  for (int i = 0; i < h; ++i) reverse(s[i].begin(), s[i].end());
  res += calc(1);
  return res;
}