#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
template <typename T>
using vt = std::vector<T>;
template <typename T>
using vvt = vt<vt<T>>;
template <typename T>
using vvvt = vt<vvt<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vvvi = vvvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;
using vvvl = vvvt<ll>;
using vb = vt<bool>;
using vpii = vt<pii>;
static inline void Solve();
int main(int argc, char* argv[]) {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
  };
  Solve();
  return 0;
}
vvvi gen_ps(const vt<string>& grid) {
  const int h = grid.size();
  const int w = grid[0].size();
  vvvi ans{vvi(h), vvi(w)};
  vvi& ps1 = ans[0];
  for (int i = 0; i < h; i++) {
    ps1[i].push_back(0);
    for (int j = 0; j < w && i + j < h; j++) {
      ps1[i].push_back(ps1[i].back() + (grid[i + j][j] == '#' ? 1 : 0));
    }
  }
  vvi& ps2 = ans[1];
  for (int j = 0; j < w; j++) {
    ps2[j].push_back(0);
    for (int i = 0; i < h && i + j < w; i++) {
      ps2[j].push_back(ps2[j].back() + (grid[i][i + j] == '#' ? 1 : 0));
    }
  }
  return ans;
}
int cnt(const vvvi& pps, int i, int j, int d) {
  if (i - j >= pps.size() || j - i >= pps.size()) return 0;
  const auto& ps = i >= j ? pps[0][i - j] : pps[1][j - i];
  int s = i >= j ? j : i;
  int e = s + d;
  if (s <= 0) s = 0;
  if (e > (int)ps.size()) e = ps.size();
  return ps[e] - ps[s];
}
void Solve() {
  int h, w;
  cin >> h >> w;
  vt<string> grid(h);
  for (int i = 0; i < h; i++) cin >> grid[i];
  auto ps1 = gen_ps(grid);
  ll ans = 0;
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      if (grid[i][j] != '#') continue;
      for (int d = 1; i + d < h && j + d < w; d++) {
        if (grid[i + d][j + d] != '#') continue;
        ans += cnt(ps1, i - d, j + d, d + 1);
        ans += cnt(ps1, i + d, j - d, d + 1);
      }
    }
  vt<string> gridt(w, string(h, '.'));
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      gridt[j][i] = grid[i][j];
    }
  auto ps2 = gen_ps(gridt);
  for (int i = 0; i < w; i++)
    for (int j = 0; j < h; j++) {
      if (gridt[i][j] != '#') continue;
      for (int d = 1; i + d < w && j + d < h; d++) {
        if (gridt[i + d][j + d] != '#') continue;
        ans += cnt(ps2, i - d + 1, j + d + 1, d - 1);
        ans += cnt(ps2, i + d + 1, j - d + 1, d - 1);
      }
    }
  cout << ans << endl;
}
