#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
constexpr int inf = 1000010;
constexpr long long INF = 1000000000000000010;
constexpr long double eps = 1e-12;
constexpr long double pi = 3.141592653589793238;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  for (long long i = 0; i < (h); i++)
    for (long long j = 0; j < (w); j++) cin >> a[i][j];
  int ans = 0;
  for (int i = 0; i < h + w - 1; i++) {
    for (int j = max(0, i - w + 1); j <= min(i, h - 1); j++) {
      for (int k = j + 1; k <= min(i, h - 1); k++) {
        int d = k - j;
        for (int l = 0; l <= d; l++) {
          int x = k + l;
          int y = i - j + d - l;
          if (h <= x || w <= y) continue;
          if (a[j][i - j] == '#' && a[k][i - k] == '#' && a[x][y] == '#') {
            ans++;
          }
        }
        for (int l = 0; l <= d; l++) {
          int x = j - l;
          int y = i - k - d + l;
          if (x < 0 || y < 0) continue;
          if (a[j][i - j] == '#' && a[k][i - k] == '#' && a[x][y] == '#') {
            ans++;
          }
        }
      }
    }
  }
  for (long long i = 0; i < (h); i++) reverse(a[i].begin(), a[i].end());
  for (int i = 0; i < h + w - 1; i++) {
    for (int j = max(0, i - w + 1); j <= min(i, h - 1); j++) {
      for (int k = j + 1; k <= min(i, h - 1); k++) {
        int d = k - j;
        for (int l = 0; l <= d; l++) {
          int x = k + l;
          int y = i - j + d - l;
          if (h <= x || w <= y) continue;
          if (a[j][i - j] == '#' && a[k][i - k] == '#' && a[x][y] == '#') {
            ans++;
          }
        }
        for (int l = 0; l <= d; l++) {
          int x = j - l;
          int y = i - k - d + l;
          if (x < 0 || y < 0) continue;
          if (a[j][i - j] == '#' && a[k][i - k] == '#' && a[x][y] == '#') {
            ans++;
          }
        }
      }
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      for (int k = j + 2; k < w; k += 2) {
        int d = (k - j) / 2;
        if (0 <= i - d && a[i - d][j + d] == '#' && a[i][j] == '#' &&
            a[i][k] == '#')
          ans--;
        if (i + d < h && a[i + d][j + d] == '#' && a[i][j] == '#' &&
            a[i][k] == '#')
          ans--;
      }
    }
  }
  vector<vector<int>> b(w, vector<int>(h));
  for (long long i = 0; i < (h); i++)
    for (long long j = 0; j < (w); j++) b[j][i] = a[i][j];
  swap(h, w);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      for (int k = j + 2; k < w; k += 2) {
        int d = (k - j) / 2;
        if (0 <= i - d && b[i - d][j + d] == '#' && b[i][j] == '#' &&
            b[i][k] == '#')
          ans--;
        if (i + d < h && b[i + d][j + d] == '#' && b[i][j] == '#' &&
            b[i][k] == '#')
          ans--;
      }
    }
  }
  cout << ans << '\n';
}
