#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
typedef struct {
  int32_t a;
  int32_t b;
} hw;
typedef struct {
  int64_t a;
  int64_t b;
} hwll;
typedef struct {
  int64_t a;
  int64_t b;
  int64_t c;
} hwllc;
typedef struct {
  hwll a;
  hwll b;
} linell;
uint64_t n, m;
uint64_t h, w;
uint64_t k;
uint64_t q;
int64_t va, vb, vc, vd, ve, vf;
uint64_t ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
uint64_t umin(uint64_t x, uint64_t y) { return (x < y) ? x : y; }
uint64_t umax(uint64_t x, uint64_t y) { return (x > y) ? x : y; }
int64_t smin(int64_t x, int64_t y) { return (x < y) ? x : y; }
int64_t smax(int64_t x, int64_t y) { return (x > y) ? x : y; }
uint64_t gcd(uint64_t x, uint64_t y) {
  if (x < y) {
    return gcd(y, x);
  } else if (y == 0) {
    return x;
  } else {
    return gcd(y, x % y);
  }
}
uint64_t bitpow(uint64_t a, uint64_t x, uint64_t modulo) {
  uint64_t result = 1;
  while (x) {
    if (x & 1) {
      result *= a;
      result %= modulo;
    }
    x /= 2;
    a = (a * a) % modulo;
  }
  return result;
}
uint64_t divide(uint64_t a, uint64_t b, uint64_t modulo) {
  return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
uint64_t udiff(uint64_t a, uint64_t b) {
  if (a >= b) {
    return a - b;
  } else {
    return b - a;
  }
}
int64_t sdiff(int64_t a, int64_t b) {
  if (a >= b) {
    return a - b;
  } else {
    return b - a;
  }
}
int bitcount(uint64_t n) {
  int result = 0;
  while (n) {
    if (n & 1) result++;
    n /= 2;
  }
  return result;
}
int32_t pullcomp(const void *left, const void *right) {
  uint64_t l = *(uint64_t *)left;
  uint64_t r = *(uint64_t *)right;
  if (l < r) {
    return -1;
  }
  if (l > r) {
    return +1;
  }
  return 0;
}
int32_t prevcomp(const void *left, const void *right) {
  uint64_t l = *(uint64_t *)left;
  uint64_t r = *(uint64_t *)right;
  if (l > r) {
    return -1;
  }
  if (l < r) {
    return +1;
  }
  return 0;
}
int32_t psllcomp(const void *left, const void *right) {
  int64_t l = *(int64_t *)left;
  int64_t r = *(int64_t *)right;
  if (l < r) {
    return -1;
  }
  if (l > r) {
    return +1;
  }
  return 0;
}
int32_t pcharcomp(const void *left, const void *right) {
  char l = *(char *)left;
  char r = *(char *)right;
  if (l < r) {
    return -1;
  }
  if (l > r) {
    return +1;
  }
  return 0;
}
int32_t pdoublecomp(const void *left, const void *right) {
  double l = *(double *)left;
  double r = *(double *)right;
  if (l < r) {
    return -1;
  }
  if (l > r) {
    return +1;
  }
  return 0;
}
int32_t pstrcomp(const void *left, const void *right) {
  char *l = *(char **)left;
  char *r = *(char **)right;
  return strcmp(l, r);
}
int32_t phwllABcomp(const void *left, const void *right) {
  hwll l = *(hwll *)left;
  hwll r = *(hwll *)right;
  if (l.a < r.a) {
    return -1;
  }
  if (l.a > r.a) {
    return +1;
  }
  if (l.b < r.b) {
    return -1;
  }
  if (l.b > r.b) {
    return +1;
  }
  return 0;
}
int32_t phwllREVcomp(const void *left, const void *right) {
  hwll l = *(hwll *)left;
  hwll r = *(hwll *)right;
  if (l.b < r.b) {
    return -1;
  }
  if (l.b > r.b) {
    return +1;
  }
  if (l.a < r.a) {
    return -1;
  }
  if (l.a > r.a) {
    return +1;
  }
  return 0;
}
int32_t ptriplecomp(const void *left, const void *right) {
  hwllc l = *(hwllc *)left;
  hwllc r = *(hwllc *)right;
  if (l.a < r.a) {
    return -1;
  }
  if (l.a > r.a) {
    return +1;
  }
  if (l.b < r.b) {
    return -1;
  }
  if (l.b > r.b) {
    return +1;
  }
  if (l.c < r.c) {
    return -1;
  }
  if (l.c > r.c) {
    return +1;
  }
  return 0;
}
int32_t ptripleREVcomp(const void *left, const void *right) {
  hwllc l = *(hwllc *)left;
  hwllc r = *(hwllc *)right;
  if (l.b < r.b) {
    return -1;
  }
  if (l.b > r.b) {
    return +1;
  }
  if (l.a < r.a) {
    return -1;
  }
  if (l.a > r.a) {
    return +1;
  }
  if (l.c < r.c) {
    return -1;
  }
  if (l.c > r.c) {
    return +1;
  }
  return 0;
}
int32_t pquadcomp(const void *left, const void *right) {
  linell l = *(linell *)left;
  linell r = *(linell *)right;
  int64_t ac = phwllABcomp(&(l.a), &(r.a));
  if (ac) return ac;
  int64_t bc = phwllABcomp(&(l.b), &(r.b));
  if (bc) return bc;
  return 0;
}
bool isinrange(int64_t left, int64_t x, int64_t right) {
  return (left <= x && x <= right);
}
bool isinrange_soft(int64_t left, int64_t x, int64_t right) {
  return (left <= x && x <= right) || (left >= x && x >= right);
}
int64_t a[1000000];
int64_t b[1000000];
int64_t c[1000000];
int64_t d[1000000];
char s[3010][3010];
char t[1000000 + 1];
hwll xy[1000000];
hwllc tup[1000000];
int64_t table[3000][3000];
uint64_t dp[305][305][602], dq[305][305][602];
int64_t fp(int64_t i, int64_t j, int64_t x) {
  if (j >= (int64_t)w) {
    int64_t d = j - (w - 1);
    i -= d;
    j -= d;
  }
  if (i >= (int64_t)h) {
    int64_t d = i - (h - 1);
    i -= d;
    j -= d;
  }
  if (i < 0 || j < 0) return 0;
  return dp[i][j][x];
}
int64_t fq(int64_t i, int64_t j, int64_t x) {
  if (j < 0) {
    int64_t d = -j;
    i -= d;
    j += d;
  }
  if (i >= (int64_t)h) {
    int64_t d = i - (h - 1);
    i -= d;
    j += d;
  }
  if (i < 0 || j >= (int64_t)w) return 0;
  return dq[i][j][x];
}
uint64_t f(int64_t i, int64_t j) {
  int64_t mov[4][2][2] = {{{-1, -1}, {-1, +1}},
                          {{-1, +1}, {+1, +1}},
                          {{+1, +1}, {+1, -1}},
                          {{+1, -1}, {-1, -1}}};
  uint64_t ra = 0;
  for (int64_t ki = 0; ki < 4; ki++) {
    int64_t x[2][2] = {{i, j}, {i, j}};
    while (true) {
      for (int64_t xi = 0; xi < 2; xi++)
        for (int64_t xj = 0; xj < 2; xj++) {
          x[xi][xj] += mov[ki][xi][xj];
        }
      if (!(isinrange(0, x[0][0], h - 1) && isinrange(0, x[0][1], w - 1) &&
            isinrange(0, x[1][0], h - 1) && isinrange(0, x[1][1], w - 1)))
        break;
      if (s[x[0][0]][x[0][1]] == '#' && s[x[1][0]][x[1][1]] == '#') {
        ra++;
      }
    }
  }
  int64_t r = 0;
  int64_t ki;
  for (ki = 1; ki <= h + w; ki++) {
    r += fp(i, j + ki * 2, ki);
    r -= fp(i - ki - 1, j + ki - 1, ki);
    r += fp(i + ki * 2, j, ki);
    r -= fp(i + ki - 1, j - ki - 1, ki);
    r += fq(i, j - ki * 2, ki);
    r -= fq(i - ki - 1, j - ki + 1, ki);
    r += fq(i + ki * 2, j, ki);
    r -= fq(i + ki - 1, j + ki + 1, ki);
  }
  return r - ra;
}
int64_t ok(int64_t x1, int64_t y1, int64_t x2, int64_t y2, int64_t x3,
           int64_t y3) {
  int64_t z1 = sdiff(x1, x2) + sdiff(y1, y2);
  int64_t z2 = sdiff(x2, x3) + sdiff(y2, y3);
  int64_t z3 = sdiff(x3, x1) + sdiff(y3, y1);
  if (z1 == z2 && z2 == z3) {
    return 1;
  }
  return 0;
}
uint64_t solve() {
  int64_t i, j, ki, li;
  int64_t result = 0;
  double dresult = 0;
  int64_t maybe = 0;
  int64_t sum = 0;
  int64_t item;
  uint64_t *dpcell;
  for (ki = 1; ki <= h; ki++) {
    for (i = 0; i < h; i++) {
      for (j = 0; j < w; j++) {
        if (i < ki) {
          dp[i][j][ki] = 0;
          dq[i][j][ki] = 0;
          continue;
        }
        if (j - ki < 0) {
          dp[i][j][ki] = 0;
        } else {
          dp[i][j][ki] = dp[i - 1][j - 1][ki];
          if (s[i][j] == '#' && s[i - ki][j - ki] == '#') {
            dp[i][j][ki]++;
          }
        }
        if (j + ki >= (int64_t)w) {
          dq[i][j][ki] = 0;
        } else {
          dq[i][j][ki] = dq[i - 1][j + 1][ki];
          if (s[i][j] == '#' && s[i - ki][j + ki] == '#') {
            dq[i][j][ki]++;
          }
        }
      }
    }
  }
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      if (s[i][j] == '#') result += f(i, j);
    }
  }
  printf("%lld\n", result);
  return 0;
success:
  puts("Yes");
  return 0;
fail:
  puts("No");
  return 1;
}
int32_t main(void) {
  int32_t i, j;
  int32_t x, y;
  scanf("%llu%llu", &h, &w);
  for (i = 0; i < h; i++) {
    scanf("%s", &s[i]);
  }
  solve();
  return 0;
}
