#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
template <class T>
void assign(V<T>& v, int n, const T& a = T()) {
  v.assign(n, a);
}
template <class T, class... Args>
void assign(V<T>& v, int n, const Args&... args) {
  v.resize(n);
  for (auto&& e : v) assign(e, args...);
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  V<string> s(h);
  for (int i = 0; i < h; ++i) cin >> s[i];
  int res = 0;
  for (int xl = 0; xl < h; ++xl)
    for (int xr = xl + 1; xr < h; ++xr)
      for (int yl = 0; yl < w; ++yl) {
        for (int yr = yl + (xr - xl + 1 >> 1);
             yr <= yl + 2 * (xr - xl) and yr < w; ++yr)
          if ((xr - xl + yr - yl) % 3 == 0) {
            int l = xr - xl + yr - yl << 1;
            if (s[xl][yl] == '#') {
              res += s[xr][yl + l / 3 - (xr - xl)] == '#' and
                     s[xl + l / 3 - (yr - yl)][yr] == '#';
            }
            if (s[xl][yr] == '#' and xr - xl != yr - yl << 1 and
                xr - xl << 1 != yr - yl) {
              res += s[xr][yr - l / 3 + (xr - xl)] == '#' and
                     s[xl + l / 3 - (yr - yl)][yl] == '#';
            }
            if (s[xr][yl] == '#' and xr - xl != yr - yl << 1 and
                xr - xl << 1 != yr - yl) {
              res += s[xl][yl + l / 3 - (xr - xl)] == '#' and
                     s[xr - l / 3 + (yr - yl)][yr] == '#';
            }
            if (s[xr][yr] == '#') {
              res += s[xl][yr - l / 3 + (xr - xl)] == '#' and
                     s[xr - l / 3 + (yr - yl)][yl] == '#';
            }
          }
      }
  cout << res << '\n';
}
