#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;
int n, m;
string s[N];
int sum1[300][600][300], sum2[300][600][300];
bool read() {
  if (!(cin >> n >> m)) return false;
  for (int i = 0; i < n; ++i) cin >> s[i];
  return true;
}
template <typename T>
long long diag(int x1, int y1, int x2, int y2, int d, T f,
               int sum[300][600][300]) {
  auto id = f(x1, y1);
  if (id < 0) return 0ll;
  auto l = x1;
  auto r = x2;
  if (l > r) swap(l, r);
  ++l;
  r -= d / 2 + 1;
  if (l >= 300 || r < 0 || l > r) return 0ll;
  return sum[d / 2][id][min(299, r)] - (l > 0 ? sum[d / 2][id][l - 1] : 0);
}
void solve() {
  for (int d = 1; d < 300; ++d) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j)
        if (s[i][j] == '#') {
          sum1[d][i + m - 1 - j][i] =
              (i + d < n && j + d < m && s[i + d][j + d] == '#');
          sum2[d][i + j][i] =
              (i + d < n && j - d >= 0 && s[i + d][j - d] == '#');
        }
    for (int id = 0; id < 600; ++id)
      for (int i = 1; i < 300; ++i) {
        sum1[d][id][i] += sum1[d][id][i - 1];
        sum2[d][id][i] += sum2[d][id][i - 1];
      }
  }
  auto ans = 0ll;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (s[i][j] == '#') {
        for (int d = 2; d < 300; d += 2) {
          if (i + d < n && s[i + d][j] == '#') {
            ans += (j >= d / 2 && s[i + d / 2][j - d / 2] == '#');
            ans += (j + d / 2 < m && s[i + d / 2][j + d / 2] == '#');
          }
          if (j + d < m && s[i][j + d] == '#') {
            ans += (i >= d / 2 && s[i - d / 2][j + d / 2] == '#');
            ans += (i + d / 2 < n && s[i + d / 2][j + d / 2] == '#');
          }
          ans += diag(
              i - d, j, i, j + d, d, [](int x, int y) { return x + m - 1 - y; },
              sum1);
          ans += diag(
              i, j + d, i + d, j, d, [](int x, int y) { return x + y; }, sum2);
          ans += diag(
              i + d, j, i, j - d, d, [](int x, int y) { return x + m - 1 - y; },
              sum1);
          ans += diag(
              i, j - d, i - d, j, d, [](int x, int y) { return x + y; }, sum2);
        }
      }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  while (read()) solve();
  return 0;
}
