#include <bits/stdc++.h>
using namespace std;
void init(int &H, int &W, int w[][310]) {
  scanf("%d %d", &H, &W);
  char c;
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j) {
      scanf("%c", &c);
      while (c != '.' && c != '#') scanf("%c", &c);
      w[i][j] = (c == '#') ? 1 : 0;
    }
}
int dist(int x, int y, int xx, int yy) { return abs(x - xx) + abs(y - yy); }
long long count(int H, int W, int w[][310]) {
  long long sum = 0;
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      for (int i2 = 0; i2 < H; ++i2)
        for (int j2 = 0; j2 < W; ++j2)
          for (int i3 = 0; i3 < H; ++i3)
            for (int j3 = 0; j3 < W; ++j3)
              if (dist(i, j, i2, j2) > 0 && w[i][j] && w[i2][j2] && w[i3][j3] &&
                  dist(i, j, i2, j2) == dist(i, j, i3, j3) &&
                  dist(i, j, i2, j2) == dist(i2, j2, i3, j3)) {
                sum += 1;
              }
  return sum / 6;
}
int main() {
  int H, W;
  int w[310][310];
  init(H, W, w);
  printf("%lld\n", count(H, W, w));
  return 0;
}
