#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int64 H, W;
  cin >> H >> W;
  int64 gap = 305;
  vector<vector<int64>> sw(910, vector<int64>(910+1, 0)), sh(910+1, vector<int64>(910, 0));
  vector<vector<int64>> cnt(910, vector<int64>(910, 0));
  vector<PII> pts;
  vector<vector<int64>> px(910); // px[i] := x座標がi
  vector<vector<int64>> py(910); // px[i] := y座標がi
  REP(i, H) {
    string s;
    cin >> s;
    REP(j, W) {
      if (s[j] == '#') {
        sw[i+j+gap][i-j+gap] = 1;
        sh[i+j+gap][i-j+gap] = 1;
        cnt[i+j+gap][i-j+gap] = 1;
        px[i-j+gap].push_back(i+j+gap);
        py[i+j+gap].push_back(i-j+gap);
        pts.emplace_back(i+j+gap, i-j+gap);
      }
    }
  }
  REP(i, 910) {
    sort(all(px[i]));
    sort(all(py[i]));
    REP(j, 910) {
      sw[i][j+1] += sw[i][j];
      sh[i+1][j] += sh[i][j];
    }
  }
//  REP(i, 20) {
//    REP(j, 20) {
//      cout << cnt[i][j] << " ";
//    }
//    cout << endl;
//  }
//  cout << endl;
//  REP(i, 20) {
//    REP(j, 20) {
//      cout << sw[i][j] << " ";
//    }
//    cout << endl;
//  }
//  cout << endl;
//  REP(i, 20) {
//    REP(j, 20) {
//      cout << sh[i][j] << " ";
//    }
//    cout << endl;
//  }

  int64 res_2 = 0, res_3 = 0; // 2回数えるのと3回数えるの
  for (auto &p : pts) {
    int64 y = p.fs, x = p.sc;
    int64 id = lower_bound(all(px[x]), y)-px[x].begin()+1;
    for (int64 yid = id; yid < px[x].size(); yid++) {
      int64 yy = px[x][yid];
      int64 dis = yy-y;
      if (dis <= x) {
        res_2 += sh[yy-1][x-dis]-sh[y][x-dis];
        res_3 += cnt[y][x-dis] + cnt[yy][x-dis];
      }
      if (x + dis < 910) {
        res_2 += sh[yy-1][x+dis]-sh[y][x+dis];
        res_3 += cnt[y][x+dis]+cnt[yy][x+dis];
      }
//      cout << "point: " << yy << " " << x << ": " << res_2 << " " << res_3 << endl;
    }
    id = lower_bound(all(py[y]), x) - py[y].begin()+1;
    for (int64 xid = id; xid < py[y].size(); xid++) {
      int xx = py[y][xid];
      int64 dis = xx-x;
      if (dis <= y) {
        res_2 += sw[y-dis][xx-1]-sw[y-dis][x];
        res_3 += cnt[y-dis][xx] + cnt[y-dis][x];
      }
      if (y + dis < 910) {
        res_2 += sw[y+dis][xx-1]-sw[y+dis][x];
        res_3 += cnt[y+dis][x]+cnt[y+dis][xx];
      }
//      cout << "point: " << y << " " << xx << ": " << res_2 << " " << res_3 << endl;
    }
//    cout << res_2 << " " << res_3 << endl;
//    cout << endl;
  }
  cout << res_2+res_3/2 << endl;
}


Measured memory_bytes: 23284