#include <bits/stdc++.h>
bool DBG = !true;
int isok(int x1, int y1, int x2, int y2, int x3, int y3) {
  int d12 = abs(x1 - x2) + abs(y1 - y2);
  int d13 = abs(x1 - x3) + abs(y1 - y3);
  int d23 = abs(x2 - x3) + abs(y2 - y3);
  return ((d12 == d13 && d12 == d23) ? 1 : 0);
}
int main() {
  int a[300][300];
  int x[90000];
  int y[90000];
  long cnt = 0;
  int sz = 0;
  int h, w;
  char s[302];
  char ch;
  fgets(s, 302, stdin);
  sscanf(s, "%d %d", &h, &w);
  for (int j = 0; j < h; j++) {
    fgets(s, 302, stdin);
    for (int i = 0; i < w; i++) {
      ch = s[i];
      if (ch == '#') {
        a[i][j] = 1;
      } else if (ch == '.') {
        a[i][j] = 0;
      } else {
        printf("INPUT ERROR\n");
        exit(0);
      }
    }
  }
  for (int j = 0; j < h; j++) {
    for (int i = 0; i < w; i++) {
      if (a[i][j]) {
        x[sz] = i;
        y[sz++] = j;
        if (DBG) printf("marking (%d,%d)\n", i, j);
      }
    }
  }
  if (!false && DBG) {
    printf("h:%d w:%d sz:%d\n", h, w, sz);
    for (int j = 0; j < h; j++) {
      for (int i = 0; i < w; i++) {
        putchar(a[i][j] ? '*' : '_');
      }
      putchar('\n');
    }
  }
  for (int i = 0; i < sz - 2; i++) {
    int x1 = x[i];
    int y1 = y[i];
    if (DBG) printf("A(%d,%d)\n", x1, y1);
    for (int j = i + 1; j < sz - 1; j++) {
      int x2 = x[j];
      int y2 = y[j];
      if (DBG) printf("B(%d,%d)\n", x2, y2);
      if (y2 == y1) {
        if ((x1 + x2) % 2 > 0 || (y1 + y2) % 2 > 0) continue;
        int x3 = (x1 + x2) / 2;
        int y3 = y1 + (x2 - x1) / 2;
        if (y3 >= h) continue;
        if (DBG)
          printf("x(%d,%d) y(%d,%d) z(%d,%d) a:%d\n", x1, y1, x2, y2, x3, y3,
                 a[x3][y3]);
        if (a[x3][y3]) cnt++;
        if (DBG && a[x3][y3])
          printf("found1(%d,%d) %d\n", x3, y3, isok(x1, y1, x2, y2, x3, y3));
      } else if (x1 > x2) {
        if (x1 - x2 > y2 - y1) {
          if ((x1 + x2 + y1 + y2) % 2 > 0) continue;
          int x3 = (x1 + x2 - y1 + y2) / 2;
          int y3 = (x1 - x2 - y1 + 3 * y2) / 2;
          if (x3 < 0 || w <= x3 || y3 < 0 || h <= y3) continue;
          if (a[x3][y3]) cnt++;
          if (DBG && a[x3][y3])
            printf("found2(%d,%d) %d\n", x3, y3, isok(x1, y1, x2, y2, x3, y3));
        } else if (x1 - x2 == y2 - y1) {
          int x3 = 2 * x1 - x2;
          int y3 = y2;
          while (x3 >= x1) {
            if (x3 < 0 || w <= x3 || y3 < 0 || h <= y3) {
              x3--;
              y3++;
              continue;
            }
            if (a[x3][y3]) cnt++;
            if (DBG && a[x3][y3])
              printf("found3(%d,%d) %d\n", x3, y3,
                     isok(x1, y1, x2, y2, x3, y3));
            x3--;
            y3++;
          }
        }
      } else if (x1 < x2) {
        if (x2 - x1 > y2 - y1) {
          if ((x1 + x2 + y1 + y2) % 2 > 0) continue;
          int x3 = (x1 + x2 + y1 - y2) / 2;
          int y3 = (-x1 + x2 - y1 + 3 * y2) / 2;
          if (x3 < 0 || w <= x3 || y3 < 0 || h <= y3) continue;
          if (a[x3][y3]) cnt++;
          if (DBG && a[x3][y3])
            printf("found4(%d,%d) %d\n", x3, y3, isok(x1, y1, x2, y2, x3, y3));
        } else if (x2 - x1 == y2 - y1) {
          int x3 = x1;
          int y3 = 2 * y2 - y1;
          while (y3 > y2) {
            if (x3 < 0 || w <= x3 || y3 < 0 || h <= y3) {
              x3--;
              y3--;
              continue;
            }
            if (a[x3][y3]) cnt++;
            if (DBG && a[x3][y3])
              printf("found5(%d,%d) %d\n", x3, y3,
                     isok(x1, y1, x2, y2, x3, y3));
            x3--;
            y3--;
          }
        }
      }
    }
  }
  printf("%ld\n", cnt);
}
