#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>

using namespace std;


char buffer[324];

int n, m;
struct point_t {
    int x, y;
    point_t(int x, int y) : x(x), y(y) {}
};

int board[301][301];
int diag1sum[301][301];
int diag2sum[301][301];

int calcd1(point_t p, point_t q) { // p\q way [p, q]
    if (q.y < p.y) return 0;
    if (q.x < 0 || q.y < 0) return 0;
    if (p.x >= m || p.y >= n) return 0;
    if (p.x < 0 || p.y < 0) {
        int d = max(-p.x, -p.y);
        p.x += d;
        p.y += d;
    }
    if (q.x >= m || q.y >= n) {
        int d = 1 + max(q.x - m, q.y - n);
        q.x -= d;
        q.y -= d;
    }
    if (p.x < 0 || p.y < 0 || p.x >= m || p.y >= n) return 0;
    if (q.x < 0 || q.y < 0 || q.x >= m || q.y >= n) return 0;
    if (q.y < p.y) return 0;
    return diag1sum[q.y][q.x] - diag1sum[p.y][p.x] + board[p.y][p.x];
}

int calcd2(point_t p, point_t q) { // q/p way [p, q]
    p.x = m-1 - p.x;
    q.x = m-1 - q.x;
    if (q.y < p.y) return 0;
    if (q.x < 0 || q.y < 0) return 0;
    if (p.x >= m || p.y >= n) return 0;
    if (p.x < 0 || p.y < 0) {
        int d = max(-p.x, -p.y);
        p.x += d;
        p.y += d;
    }
    if (q.x >= m || q.y >= n) {
        int d = 1 + max(q.x - m, q.y - n);
        q.x -= d;
        q.y -= d;
    }
    if (p.x < 0 || p.y < 0 || p.x >= m || p.y >= n) return 0;
    if (q.x < 0 || q.y < 0 || q.x >= m || q.y >= n) return 0;
    if (q.y < p.y) return 0;
    p.x = m-1 - p.x;
    q.x = m-1 - q.x;
    return diag2sum[q.y][q.x] - diag2sum[p.y][p.x] + board[p.y][p.x];
}

int calcd(int x1, int y1, int x2, int y2) {
    if (y1 > y2) {
        swap(x1, x2);
        swap(y1, y2);
    }
    if (x1 + y1 == x2 + y2) {
        return calcd2(point_t(x1, y1), point_t(x2, y2));
    }
    return calcd1(point_t(x1, y1), point_t(x2, y2));
}

int count_intersection(int y1, int x1) {
    int wv[4][2] = {
            1, 1,
            1, -1,
            -1, -1,
            -1, 1
    };
    int ans = 0;
    int ans2 = 0;

    for (int way = 0; way < 4; way++) {
        for (int d = 1; ; d++) {
            int y2 = y1 + wv[way][0] * d;
            int x2 = x1 + wv[way][1] * d;
            if (y2 < 0 || x2 < 0 || y2 >= n || x2 >= m) {
                break;
            }

            if (board[y2][x2] == 0) continue;

            int w2 = (way + 1) % 4;
            int y3 = y1 + wv[w2][0] * d;
            int x3 = x1 + wv[w2][1] * d;
            int y4 = y3 + wv[way][0] * (d-1);
            int x4 = x3 + wv[way][1] * (d-1);
            ans += calcd(x3, y3, x4, y4);
        }
    }

    return ans;
}


int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        scanf("%s", buffer);
        for (int j = 0; j < m; j++) {
            board[i][j] = (buffer[j] == '#' ? 1 : 0);
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            diag1sum[i][j] += board[i][j];
            diag2sum[i][j] += board[i][j];

            if (i + 1 < n && j + 1 < m) {
                diag1sum[i+1][j+1] = diag1sum[i][j];
            }
            if (i + 1 < n && j - 1 >= 0) {
                diag2sum[i+1][j-1] = diag2sum[i][j];
            }
        }
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (board[i][j]) {
                auto sub = count_intersection(i, j);
                ans += sub;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1280