#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
int H, W;
const int L = 350;
int board[1001][1001];
const int X = 990;
int rig[2002][1002];
int lef[2002][1002];
void init() {
  for (int i = X - 1; i >= 0; i--) {
    for (int j = 0; i + j < X; j++) {
      rig[X - i][j + 1] += rig[X - i][j];
      rig[X - i][j + 1] += board[i + j][j];
    }
  }
  for (int i = 1; i < X; i++) {
    for (int j = 0; i + j < X; j++) {
      rig[X + i][j + 1] += rig[X + i][j];
      rig[X + i][j + 1] += board[j][i + j];
    }
  }
  for (int i = 0; i < X; i++) {
    for (int j = 0; i - j >= 0; j++) {
      lef[i][j + 1] += lef[i][j];
      lef[i][j + 1] += board[j][i - j];
    }
  }
  for (int i = 1; i < X; i++) {
    for (int j = 0; i + j < X; j++) {
      lef[X - 1 + i][j + 1] += lef[X - 1 + i][j + 1];
      lef[X - 1 + i][j + 1] += board[i + j][X - 1 - j];
    }
  }
}
int leftquery(int ax, int ay, int bx, int by) {
  if (ax > bx) {
    swap(ax, bx);
    swap(ay, by);
  }
  int p = ax + ay;
  int px = 0;
  if (p > X - 1) px = p - (X - 1);
  int py = p;
  if (p > X - 1) py = X - 1;
  int zero = px - py;
  int s = ((ax - ay) - zero) / 2;
  int t = ((bx - by) - zero) / 2;
  return lef[p][t + 1] - lef[p][s];
}
int rightquery(int ax, int ay, int bx, int by) {
  if (ax > bx) {
    swap(ax, bx);
    swap(ay, by);
  }
  int p = ay - ax + X;
  int px = 0;
  if (ay - ax < 0) px = ax - ay;
  int py = 0;
  if (ay - ax > 0) py = ay - ax;
  int zero = px + py;
  int s = ((ax + ay) - zero) / 2;
  int t = ((bx + by) - zero) / 2;
  return rig[p][t + 1] - rig[p][s];
}
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < (H); ++i) cin >> S[i];
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') board[L + i][L + j] = 1;
    }
  init();
  long long ans = 0;
  for (int len = 1; len <= 300; len++) {
    for (int k = 0; k < 4; k++) {
      for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++) {
          int x = L + i;
          int y = L + j;
          int ax = x + dx[k] * len;
          int ay = y + dy[k] * len;
          int bx = x + dx[(k + 1) % 4] * len;
          int by = y + dy[(k + 1) % 4] * len;
          if (board[ax][ay] == 1 && board[bx][by] == 1) {
            int res = 0;
            if (k % 2 == 0)
              res += leftquery(x + x - ax, y + y - ay, x + x - bx, y + y - by);
            else
              res += rightquery(x + x - ax, y + y - ay, x + x - bx, y + y - by);
            ans += res;
          }
        }
    }
    for (int k = 0; k < 4; k++) {
      for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++) {
          int x = L + i;
          int y = L + j;
          int ax = x + dx[k] * len;
          int ay = y + dy[k] * len;
          int bx = x + dx[(k + 1) % 4] * len;
          int by = y + dy[(k + 1) % 4] * len;
          int cx = x + dx[(k + 2) % 4] * len;
          int cy = y + dy[(k + 2) % 4] * len;
          if (board[ax][ay] && board[bx][by] && board[cx][cy]) ans--;
        }
    }
  }
  cout << ans << endl;
  return 0;
}
