#include <bits/stdc++.h>
using namespace std;
int h, w;
char arr[300][301];
int opts[8][6] = {{1, 0, -1, 0, 0, 1},  {1, 0, -1, 0, 0, -1},
                  {0, 1, 0, -1, 1, 0},  {0, 1, 0, -1, -1, 0},
                  {-2, 0, 0, -2, 1, 1}, {2, 0, 0, 2, -1, -1},
                  {2, 0, 0, -2, -1, 1}, {-2, 0, 0, 2, 1, -1}};
bool isIn(int x, int y) { return (x >= 0 && x < w && y >= 0 && y < h); }
int main() {
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    scanf("%s", arr[i]);
  }
  long long ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      for (int k = 0; k < 8; k++) {
        int size = 1;
        while (true) {
          int ps[6];
          for (int l = 0; l < 6; l += 2) {
            ps[l] = j + size * opts[k][l];
            ps[l + 1] = i + size * opts[k][l + 1];
          }
          bool flg = true;
          for (int l = 0; l < 6; l += 2) {
            flg &= isIn(ps[i + 1], ps[i]);
          }
          if (!flg) break;
          flg = true;
          for (int l = 0; l < 6; l += 2) {
            flg &= (arr[ps[l + 1]][ps[l] == '#']);
          }
          ans += ((flg) ? 1 : 0);
          size++;
        }
      }
    }
  }
  cout << ans << endl;
}
