#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int H, W;
    cin >> H >> W;
    string S[320];
    for(int i = 1; i <= H; i++){
        cin >> S[i];
        S[i] = "a" + S[i];
    }
    vector<int> points[605];
    vector<int> points2[605];
    for(int h = 1; h <= H; h++){
        for(int w = 1; w <= W; w++){
            if(S[h][w] == '#'){
                points[h + w].push_back(h - w);
                points2[h - w + 300].push_back(h + w);
            }
        }
    }
    for(int i = 0; i <= 600; i++){
        sort(points[i].begin(), points[i].end());
        sort(points2[i].begin(), points2[i].end());
    }
    int ans = 0;
    for(int X = 0; X <= 600; X++){
        int number = points[X].size();
        for(int j = 0; j < number; j++){
            for(int k = j + 1; k < number; k++){
                int dY = points[X][k] - points[X][j];
                if(X - dY >= 0){
                    ans += distance(lower_bound(points[X - dY].begin(), points[X - dY].end(), points[X][j]), upper_bound(points[X - dY].begin(), points[X - dY].end(), points[X][k]));
                }
                if(X + dY <= 600){
                    ans += distance(lower_bound(points[X + dY].begin(), points[X + dY].end(), points[X][j]), upper_bound(points[X + dY].begin(), points[X + dY].end(), points[X][k]));
                }
            }
        }
    }
    for(int X = 0; X <= 600; X++){
        int number = points2[X].size();
        for(int j = 0; j < number; j++){
            for(int k = j + 1; k < number; k++){
                int dY = points2[X][k] - points2[X][j];
                if(X - dY >= 0){
                    ans += distance(upper_bound(points2[X - dY].begin(), points2[X - dY].end(), points2[X][j]), lower_bound(points2[X - dY].begin(), points2[X - dY].end(), points2[X][k]));
                }
                if(X + dY <= 600){
                    ans += distance(upper_bound(points2[X + dY].begin(), points2[X + dY].end(), points2[X][j]), lower_bound(points2[X + dY].begin(), points2[X + dY].end(), points2[X][k]));
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}
