#include <bits/stdc++.h>
using namespace std;
long long dx[4] = {-1, 1, -1, 1};
long long dy[4] = {-1, 1, 1, -1};
long long solve(vector<string> &table, long long a, long long b) {
  long long ret = 0;
  vector<long long> np(8);
  for (long long i = 0; i < 4; i++) {
    np[i * 2] = a;
    np[i * 2 + 1] = b;
  }
  while (1) {
    long long cnt = 0;
    for (long long i = 0; i < 4; i++) {
      np[i * 2] += dx[i];
      np[i * 2 + 1] += dy[i];
      if (!(((0) <= (np[i * 2]) && (np[i * 2]) < (table.size())) &&
            ((0) <= (np[i * 2 + 1]) && (np[i * 2 + 1]) < (table[0].size()))))
        cnt++;
    }
    if (cnt > 1) break;
    cnt = 0;
    for (long long i = 0; i < 4; i++) {
      if (table[np[i * 2]][np[i * 2 + 1]] == '#') cnt++;
    }
    if (cnt >= 3) ret++;
  }
  return ret;
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  long long h;
  cin >> h;
  ;
  long long w;
  cin >> w;
  ;
  ;
  vector<string> table(h);
  for (long long i = 0; i < h; i++) cin >> table[i];
  long long ans = 0;
  for (long long i = 0; i < h; i++) {
    for (long long j = 0; j < w; j++) {
      ans += solve(table, i, j);
    }
  }
  cout << ans << endl;
  return 0;
}
