#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
int N, M, K;
vector<string> F;
bool valid_coord(int x, int y) {
  return 0 <= x && x < N && 0 <= y && y < M && F[x][y] == '#';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ((void)0);
  ((void)0);
  long long ans = 0;
  cin >> N >> M;
  K = max(N, M);
  F.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> F[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      for (int k = 1; k <= K; k++) {
        for (int l = 0; l < 4; l++) {
          if (valid_coord(i + k * dx[l], j + k * dy[l]) &&
              valid_coord(i + k * dx[(l + 1) & 3], j + k * dy[(l + 1) & 3])) {
            int x1 = i + k * dx[(l + 2) & 3], y1 = j + k * dy[(l + 2) & 3],
                x2 = i + k * dx[(l + 3) & 3], y2 = j + k * dy[(l + 3) & 3];
            int dx = (x2 - x1) / k, dy = (y2 - y1) / k;
            while (x1 != x2 || y1 != y2) {
              ans += valid_coord(x1, y1);
              x1 += dx;
              y1 += dy;
            }
          }
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
