use std::cmp::{max, min};

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let h: usize = sc.read();
    let w: usize = sc.read();
    let mut board = vec![vec![false; w]; h];
    for i in 0..h {
        let s = sc.chars();
        for j in 0..w {
            board[i][j] = s[j] == '#';
        }
    }

    let board2: Vec<Vec<bool>> = board
        .iter()
        .map(|v| v.iter().cloned().rev().collect())
        .collect();

    let ans1 = solve(&board);
    let ans2 = solve(&board2);

    let mut lines = vec![vec![]; h + w - 1];
    for i in 0..h {
        for j in 0..w {
            if board[i][j] {
                lines[i + j].push(j);
            }
        }
    }

    let mut ans3 = 0;
    for (start, mut line) in lines.into_iter().enumerate() {
        let s = line.len();
        line.sort();
        for i in 0..s {
            let (i1, j1) = (start - line[i], line[i]);
            for j in 0..i {
                let (i2, j2) = (start - line[j], line[j]);
                let d = i2 - i1;
                if i2 + d < h && board[i2 + d][j1] {
                    ans3 += 1;
                }
                if j1 + d < w && board[i2][j1 + d] {
                    ans3 += 1;
                }
                if j2 >= d && board[i1][j2 - d] {
                    ans3 += 1;
                }
                if i1 >= d && board[i1 - d][j2] {
                    ans3 += 1;
                }
            }
        }
    }

    println!("{}", ans1 + ans2 - ans3);
}

fn solve(board: &Vec<Vec<bool>>) -> usize {
    let h = board.len();
    let w = board[0].len();

    let mut sum = vec![vec![0; w + 1]; h + w - 1];
    for start in 0..(h + w - 1) {
        for i in 0..w {
            sum[start][i + 1] = sum[start][i]
                + if start >= i && start - i < h && board[start - i][i] {
                    1
                } else {
                    0
                };
        }
    }

    let mut points = vec![vec![]; h + w - 1];
    for i in 0..h {
        for j in 0..w {
            let start = i + j;
            if board[i][j] {
                points[start].push(j);
            }
        }
    }

    let mut ans = 0;
    for start in 0..(h + w - 1) {
        let p = points[start].len();
        points[start].sort();
        for i in 0..p {
            for j in 0..i {
                let pi = points[start][i];
                let pj = points[start][j];
                let d = pi - pj;
                if start >= 2 * d {
                    let idx = start - 2 * d;
                    ans += sum[idx][min(pj + 1, w)] - if pj >= d { sum[idx][pj - d] } else { 0 };
                }
                if start + 2 * d < sum.len() {
                    let idx = start + 2 * d;
                    ans += sum[idx][min(pi + d + 1, w)] - sum[idx][pi];
                }
            }
        }
    }
    ans
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
