#include <bits/stdc++.h>
template <class T>
using vv = std::vector<std::vector<T> >;
template <typename T>
std::ostream& operator<<(std::ostream& s, const std::vector<T>& v) {
  int len = v.size();
  s << "\n";
  for (int(i) = (0); (i) < (len); ++(i)) {
    s << v[i];
    if (i < len - 1) {
      s << "\t";
    }
  }
  s << "\n";
  return s;
}
template <typename T>
std::ostream& operator<<(std::ostream& s,
                         const std::vector<std::vector<T> >& vv) {
  int len = vv.size();
  for (int(i) = (0); (i) < (len); ++(i)) {
    s << vv[i];
  }
  return s;
}
template <typename T>
std::ostream& operator<<(std::ostream& s, const std::deque<T>& v) {
  int len = v.size();
  s << "\n";
  for (int(i) = (0); (i) < (len); ++(i)) {
    s << v[i];
    if (i < len - 1) {
      s << "\t";
    }
  }
  s << "\n";
  return s;
}
template <typename T>
std::ostream& operator<<(std::ostream& s,
                         const std::deque<std::deque<T> >& vv) {
  int len = vv.size();
  for (int(i) = (0); (i) < (len); ++(i)) {
    s << vv[i];
  }
  return s;
}
template <typename T>
std::ostream& operator<<(std::ostream& s, const std::set<T>& v) {
  s << "\n";
  for (auto elm : v) {
    s << elm << "\t";
  }
  s << "\n";
  return s;
}
inline void scan(int& a) { scanf("%d", &a); }
inline void scan(int& a, int& b) { scanf("%d%d", &a, &b); }
inline void scan(int& a, int& b, int& c) { scanf("%d%d%d", &a, &b, &c); }
inline void scan(int& a, int& b, int& c, int& d) {
  scanf("%d%d%d%d", &a, &b, &c, &d);
}
inline void scan(std::vector<int>& v) {
  int sz = v.size();
  for (int(i) = (0); (i) < (sz); ++(i)) {
    scan(v[i]);
  }
}
inline void scan(std::vector<std::vector<int> >& v) {
  int sz = v.size();
  for (int(i) = (0); (i) < (sz); ++(i)) {
    scan(v[i]);
  }
}
inline void scan(long long& a) { scanf("%lld", &a); }
inline void scan(long long& a, long long& b) { scanf("%lld%lld", &a, &b); }
inline void scan(long long& a, long long& b, long long& c) {
  scanf("%lld%lld%lld", &a, &b, &c);
}
inline void scan(long long& a, long long& b, long long& c, long long& d) {
  scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
}
inline void scan(std::vector<long long>& v) {
  int sz = v.size();
  for (int(i) = (0); (i) < (sz); ++(i)) {
    scan(v[i]);
  }
}
inline void scan(std::vector<std::vector<long long> >& v) {
  int sz = v.size();
  for (int(i) = (0); (i) < (sz); ++(i)) {
    scan(v[i]);
  }
}
inline void scan(char& a) { scanf(" %c", &a); }
inline void scan(std::vector<char>& v) {
  int sz = v.size();
  for (int(i) = (0); (i) < (sz); ++(i)) {
    scan(v[i]);
  }
}
inline void scan(std::vector<std::vector<char> >& v) {
  int sz = v.size();
  for (int(i) = (0); (i) < (sz); ++(i)) {
    scan(v[i]);
  }
}
inline void scan(std::string& s) {
  char BUF[3000000];
  scanf(" %s", BUF);
  s = std::string(BUF);
}
inline void print(int a) { printf("%d\n", a); }
inline void print(int a, int b) { printf("%d %d\n", a, b); }
inline void print(long long a) { printf("%lld\n", a); }
inline void print(long long a, long long b) { printf("%lld %lld\n", a, b); }
inline void print(std::string s) { std::cout << s << "\n"; }
inline void print_yn(bool flg) {
  if (flg) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}
using namespace std;
int main() {
  int h, w;
  scan(h, w);
  vector<std::vector<std::vector<int> > > plus(600);
  vector<std::vector<std::vector<int> > > minus(600);
  for (int(i) = (0); (i) < (h); ++(i)) {
    for (int(j) = (0); (j) < (w); ++(j)) {
      char c;
      scan(c);
      if (c == '#') {
        plus[i + j].push_back({i, j});
        minus[i - j + 299].push_back({i, j});
      }
    }
  }
  int ans = 0;
  for (int(i) = (0); (i) < (600); ++(i)) {
    int sz = plus[i].size();
    if (sz < 2) {
      continue;
    }
    for (int(j) = (0); (j) < (sz); ++(j)) {
      for (int(k) = (j + 1); (k) < (sz); ++(k)) {
        int y0 = plus[i][j][0];
        int y1 = plus[i][k][0];
        int md = 2 * (y1 - y0);
        int targ = i - md;
        if (targ >= 0) {
          int add = lower_bound(begin(plus[targ]), end(plus[targ]),
                                (std::vector<int>){y1 - md / 2 + 1, -1}) -
                    lower_bound(begin(plus[targ]), end(plus[targ]),
                                (std::vector<int>){y0 - md / 2, 0});
          add = max(add, 0);
          ans += add;
        }
        targ = i + md;
        if (targ < 600) {
          int add = lower_bound(begin(plus[targ]), end(plus[targ]),
                                (std::vector<int>){y1 + md / 2 + 1, -1}) -
                    lower_bound(begin(plus[targ]), end(plus[targ]),
                                (std::vector<int>){y0 + md / 2, 0});
          add = max(add, 0);
          ans += add;
        }
      }
    }
  }
  for (int(i) = (0); (i) < (600); ++(i)) {
    int sz = minus[i].size();
    if (sz < 2) {
      continue;
    }
    for (int(j) = (0); (j) < (sz); ++(j)) {
      for (int(k) = (j + 1); (k) < (sz); ++(k)) {
        int y0 = minus[i][j][0];
        int y1 = minus[i][k][0];
        int md = 2 * (y1 - y0);
        int targ = i - md;
        if (targ >= 0) {
          int add = lower_bound(begin(minus[targ]), end(minus[targ]),
                                (std::vector<int>){y1 - md / 2, -1}) -
                    lower_bound(begin(minus[targ]), end(minus[targ]),
                                (std::vector<int>){y0 - md / 2 + 1, 0});
          add = max(add, 0);
          ans += add;
        }
        targ = i + md;
        if (targ < 600) {
          int add = lower_bound(begin(minus[targ]), end(minus[targ]),
                                (std::vector<int>){y1 + md / 2, -1}) -
                    lower_bound(begin(minus[targ]), end(minus[targ]),
                                (std::vector<int>){y0 + md / 2 + 1, 0});
          add = max(add, 0);
          ans += add;
        }
      }
    }
  }
  print(ans);
  return 0;
}
