#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846264;
const int mod = 1000000007;
int H, W;
int mh(int a, int b, int c, int d) { return abs(a - c) + abs(b - d); }
int in(int a, int b) { return ((0 <= a && a < H) && (0 <= b && b < W)); }
int main() {
  int h, w;
  cin >> h >> w;
  H = h, W = w;
  vector<vector<int>> b = vector<vector<int>>(h + 1, vector<int>(w + 1, 0));
  for (int i = (0); i < (h); ++i) {
    for (int j = (0); j < (w); ++j) {
      char c;
      cin >> c;
      if (c == '#') b[i][j] = 1;
    }
  }
  long long ans = 0;
  for (int i = (0); i < (h); ++i) {
    for (int j = (0); j < (w); ++j) {
      for (int k = (1); k < (300); ++k) {
        int f = 0;
        for (int t = (0); t < (4); ++t) {
          int x[2] = {}, y[2] = {};
          if (t == 0) {
            x[0] = i + 2 * k;
            y[0] = j;
            x[1] = i + 1 * k;
            y[1] = j + 1 * k;
          }
          if (t == 1) {
            x[0] = i + 2 * k;
            y[0] = j;
            x[1] = i + 1 * k;
            y[1] = j - 1 * k;
          }
          if (t == 2) {
            x[0] = i + 1 * k;
            y[0] = j + 1 * k;
            x[1] = i + 1 * k;
            y[1] = j - 1 * k;
          }
          if (t == 3) {
            x[0] = i + 1 * k;
            y[0] = j + 1 * k;
            x[1] = i;
            y[1] = j + 2 * k;
          }
          int f2 = 1;
          for (int ii = (0); ii < (2); ++ii) {
            if (!in(x[ii], y[ii]) || b[x[ii]][y[ii]] == 0) f2 = 0;
          }
          if (f2 == 0) continue;
          ans++;
          f++;
        }
        if (f == 0) break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
