#include <bits/stdc++.h>
using namespace std;
double dot(complex<double> a, complex<double> b) {
  return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
  return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
  return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
  double cosine = dot(a, b) / (leng(a) * leng(b));
  double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
  double kaku = acos(cosine);
  if (sine <= 0) {
    kaku = 2 * 3.141592653589793 - kaku;
  }
  return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
  vector<int> ans;
  double now_minnest = a[0].real();
  int now_itr = 0;
  for (long long i = 0; i < a.size(); ++i) {
    if (now_minnest > a[i].real()) {
      now_minnest = a[i].real();
      now_itr = i;
    }
  }
  ans.push_back(now_itr);
  complex<double> ba(0, 1);
  while (true) {
    int now_go = 0;
    double now_min = 0;
    int starter = ans[ans.size() - 1];
    for (int i = 0; i < a.size(); ++i) {
      if (i != starter) {
        double goa = angles(ba, a[i] - a[starter]);
        if (goa > now_min) {
          now_min = goa;
          now_go = i;
        }
      }
    }
    if (now_go == ans[0]) break;
    ans.push_back(now_go);
    ba = complex<double>(a[now_go] - a[starter]);
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long dp[1000][1000] = {};
int main() {
  iostream::sync_with_stdio(false);
  long long h, w;
  cin >> h >> w;
  vector<string> inputs;
  for (long long i = 0; i < h; ++i) {
    string a;
    cin >> a;
    inputs.push_back(a);
    for (long long q = 0; q < w; ++q) {
      if (a[q] == '#') {
        dp[i][q]++;
      }
    }
  }
  for (long long i = 0; i < (h + w + 1); ++i) {
    for (long long q = 0; q < min(i + 1, w + 1); ++q) {
      long long first_x = i - q;
      long long first_y = q;
      if (first_x < h) {
        if (q >= 1 && first_x + 1 < h) {
          dp[first_x][first_y] += dp[first_x + 1][first_y - 1];
        }
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (h + w + 1); ++i) {
    for (long long q = 0; q < min(i + 1, w); ++q) {
      long long first_x = i - q;
      long long first_y = q;
      if (first_x < h && inputs[first_x][first_y] == '#') {
        for (long long j = q + 1; j < min(i + 1, w); ++j) {
          long long second_x = i - j;
          long long second_y = j;
          if (second_x < h && inputs[second_x][second_y] == '#') {
            long long geko_x = first_x - 2 * (j - q);
            long long geko_y = first_y;
            if (geko_x < 0) {
              geko_y += geko_x;
              geko_x = 0;
            }
            if (geko_x < h && geko_y >= 0 && geko_y < w) {
              ans += dp[geko_x][geko_y];
            }
            geko_x = second_x;
            geko_y = second_y - 2 * (j - q);
            geko_x++;
            geko_y--;
            if (geko_x >= 0 && geko_x < h && geko_y >= 0 && geko_y < w) {
              ans -= dp[geko_x][geko_y];
            }
            geko_x = first_x;
            geko_y = first_y + 2 * (j - q);
            long long gogo = max(0LL, geko_y - (w - 1));
            geko_y -= gogo;
            geko_x += gogo;
            if (geko_x >= 0 && geko_x < h && geko_y >= 0 && geko_y < w) {
              ans += dp[geko_x][geko_y];
            }
            geko_x = second_x + 2 * (j - q);
            geko_y = second_y;
            geko_x++;
            geko_y--;
            if (geko_x >= 0 && geko_x < h && geko_y >= 0 && geko_y < w) {
              ans -= dp[geko_x][geko_y];
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
