#include <bits/stdc++.h>
char s[512][512], tmp[512][512];
std::vector<int> dp[512 * 2][512];
long long int solve(int n) {
  0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) 0;
    0;
  }
  long long int res = 0;
  for (int i = 0; i < n * 2; ++i) {
    for (int j = 0; j <= i; ++j) {
      dp[i][j].clear();
      for (int px = 0, py = i, qx = j, qy = i - j; qy >= 0;
           ++px, --py, ++qx, --qy)
        if (px < n && py < n && qx < n && qy < n)
          if (s[px][py] == '#' && s[qx][qy] == '#') dp[i][j].push_back(px);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (s[i][j] != '#') continue;
      for (int k = i + j; k < n * 2; k += 2) {
        int d = (k - (i + j)) / 2;
        int t = std::lower_bound(dp[k][d].begin(), dp[k][d].end(), i + d) -
                std::lower_bound(dp[k][d].begin(), dp[k][d].end(), i);
        res += t;
        if (t) 0;
      }
    }
  }
  0;
  return res;
}
void rotate(int n) {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) tmp[j][n - 1 - i] = s[i][j];
  memcpy(s, tmp, sizeof(s));
}
int main() {
  int h, w;
  scanf("%d%d\n", &h, &w);
  for (int i = 0; i < h; ++i) fgets(s[i], 512, stdin);
  int n = std::max(h, w);
  long long int ans = solve(n);
  rotate(n), ans += solve(n);
  rotate(n), ans += solve(n);
  rotate(n), ans += solve(n);
  printf("%lld\n", ans);
  return 0;
}
