#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
};
int main() {
  int H, W;
  cin >> H >> W;
  int d = (H - 1) + (W - 1);
  int s = min(H - 1, W - 1);
  int dmax = 2 * min(d / 3, s);
  vector<string> b(H);
  vector<point> p;
  for (int y = 0; y < H; ++y) {
    string s;
    cin >> s;
    b[y] = s;
    for (int x = 0; x < W; ++x) {
      if (s[x] == '#') {
        p.push_back({x, y});
      }
    }
  }
  long long r = 0;
  int n = p.size();
  for (int i = 0; i < n - 2; ++i) {
    const point& pi = p[i];
    for (int j = i + 1; j < n - 1; ++j) {
      const point& pj = p[j];
      int d = abs(pi.x - pj.x) + abs(pi.y - pj.y);
      if (d > dmax || (d & 1)) continue;
      int h = d >> 1;
      if (pi.y == pj.y) {
        int x = pi.x + h;
        int y = pi.y + h;
        if (y < H && b[y][x] == '#') {
          ++r;
        }
      } else if (pi.x > pj.x) {
        int x = pj.x + h;
        int y = pj.y + h;
        if (x < W && y < H && y < pi.y + d && b[y][x] == '#') {
          ++r;
        }
        if (pi.y + h == pj.y) {
          for (int t = 0; t <= h; ++t) {
            int x = pi.x + t;
            if (x >= W) break;
            int y = pi.y + d - t;
            if (y < H && b[y][x] == '#') {
              ++r;
            }
          }
        }
      } else if (pi.x < pj.x) {
        int x = pj.x - h;
        int y = pj.y + h;
        if (x >= 0 && y < H && y < pi.y + d && b[y][x] == '#') {
          ++r;
        }
        if (pi.y + h == pj.y) {
          for (int t = 0; t < h; ++t) {
            int x = pi.x - t;
            if (x < 0) break;
            int y = pi.y + d - t;
            if (y < H && b[y][x] == '#') {
              ++r;
            }
          }
        }
      }
    }
  }
  cout << r << '\n';
  return 0;
}
