#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
  return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
  std::copy(std::begin(c), std::end(c),
            std::ostream_iterator<typename C::value_type>(os, " "));
  os << std::endl;
}
int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (int i = 0; i < h; ++i) {
    cin >> s[i];
  }
  map<int, vector<int>> pos, post;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (s[i][j] == '#') {
        pos[i + j].push_back(j - i);
        post[i - j].push_back(i + j);
      }
    }
  }
  for (auto &p : pos) {
    sort(p.second.begin(), p.second.end());
  }
  for (auto &p : post) {
    sort(p.second.begin(), p.second.end());
  }
  ll ret = 0;
  for (auto &p : pos) {
    int n = p.second.size();
    if (n >= 2) {
      for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
          int dist = p.second[j] - p.second[i];
          assert(dist > 0);
          if (pos.count(p.first - dist) != 0) {
            ret += upper_bound(pos[p.first - dist].begin(),
                               pos[p.first - dist].end(), p.second[j]) -
                   lower_bound(pos[p.first - dist].begin(),
                               pos[p.first - dist].end(), p.second[i]);
          }
          if (pos.count(p.first + dist) != 0) {
            ret += upper_bound(pos[p.first + dist].begin(),
                               pos[p.first + dist].end(), p.second[j]) -
                   lower_bound(pos[p.first + dist].begin(),
                               pos[p.first + dist].end(), p.second[i]);
          }
        }
      }
    }
  }
  for (auto &p : post) {
    int n = p.second.size();
    if (n >= 2) {
      for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
          int dist = p.second[j] - p.second[i];
          assert(dist > 0);
          if (post.count(p.first - dist) != 0) {
            ret += lower_bound(post[p.first - dist].begin(),
                               post[p.first - dist].end(), p.second[j]) -
                   upper_bound(post[p.first - dist].begin(),
                               post[p.first - dist].end(), p.second[i]);
          }
          if (post.count(p.first + dist) != 0) {
            ret += lower_bound(post[p.first + dist].begin(),
                               post[p.first + dist].end(), p.second[j]) -
                   upper_bound(post[p.first + dist].begin(),
                               post[p.first + dist].end(), p.second[i]);
          }
        }
      }
    }
  }
  cout << ret << "\n";
  return 0;
}
