#include <bits/stdc++.h>
using namespace std;
const int MN = 666;
struct Fenwick {
  vector<int> tree;
  void init() { tree = vector<int>(MN + 1, 0); }
  void upd(int idx, int val) {
    for (int i = idx + 1; i <= MN; i += (i & -i)) tree[i] += val;
  }
  int quer(int a) {
    int ret = 0;
    for (int i = a + 1; i >= 1; i -= (i & -i)) ret += tree[i];
    return ret;
  }
  int quer(int a, int b) { return quer(b) - quer(a - 1); }
} fw[MN][MN];
int H, W;
char G[MN][MN], T[MN][MN];
long long ans, sub;
void solve() {
  for (int i = 0; i < H + W; i++)
    for (int j = 0; j <= H + W; j++) fw[i][j].init();
  for (int i = 0; i < H + W; i++) {
    for (int y = 0; y < H; y++) {
      int x = i - y;
      if (x < 0 || W <= x) continue;
      if (G[y][x] != '#') continue;
      for (int d = 2; d <= H + W; d += 2) {
        int ny = y - d / 2;
        int nx = x + d / 2;
        if (ny < 0 || H <= ny || nx < 0 || W <= nx) continue;
        if (G[ny][nx] != '#') continue;
        fw[i][d].upd(y, 1);
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (G[i][j] != '#') continue;
      for (int k = 2; k <= i + j; k += 2) {
        ans += fw[i + j - k][k].quer(max(0, i - k / 2), i);
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (G[i][j] != '#') continue;
      for (int k = 1; k <= max(H, W); k++) {
        if (i - k < 0 || H <= i + k || W <= j + k) continue;
        if (G[i - k][j + k] == '#' && G[i + k][j + k] == '#') sub++;
      }
    }
  }
}
void Rotate() {
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++) T[j][H - 1 - i] = G[i][j];
  for (int i = 0; i < W; i++)
    for (int j = 0; j < H; j++) G[i][j] = T[i][j];
  swap(H, W);
}
int main() {
  scanf("%d %d", &H, &W);
  for (int i = 0; i < H; i++) {
    scanf("\n");
    for (int j = 0; j < W; j++) {
      scanf("%c", &G[i][j]);
    }
  }
  for (int i = 0; i < 4; i++) {
    solve();
    Rotate();
  }
  printf("%lld", ans - sub);
}
