#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        h: usize,
        w: usize,
        bd: [chars; h],
    }

    let mut ans = 0;
    for y1 in 0..h {
        for x1 in 0..w {
            if bd[y1][x1] != '#' {
                continue;
            }
            for y2 in 0..h {
                for x2 in 0..w {
                    if (x1, y1) == (x2, y2) || bd[y2][x2] != '#' {
                        continue;
                    }

                    if y1 == y2 {
                        let l = (x2 as i64 - x1 as i64).abs();
                        if l % 2 != 0 {
                            continue;
                        }
                        let x3 = x1 as i64 + l / 2;
                        {
                            let y3 = y1 as i64 + l / 2;
                            if x3 < w as _ && y3 < h as _ && bd[y3 as usize][x3 as usize] == '#' {
                                // println!("{:?} {:?} {:?}", (x1, y1), (x2, y2), (x3, y3));
                                ans += 2;
                            }
                        }
                        {
                            let y3 = y1 as i64 - l / 2;
                            if x3 < w as _ && y3 >= 0 as _ && bd[y3 as usize][x3 as usize] == '#' {
                                // println!("{:?} {:?} {:?}", (x1, y1), (x2, y2), (x3, y3));
                                ans += 2;
                            }
                        }
                    } else if x1 == x2 {
                        let l = (y2 as i64 - y1 as i64).abs();
                        if l % 2 != 0 {
                            continue;
                        }
                        let y3 = y1 as i64 + l / 2;
                        {
                            let x3 = x1 as i64 + l / 2;
                            if x3 < w as _ && y3 < h as _ && bd[y3 as usize][x3 as usize] == '#' {
                                // println!("{:?} {:?} {:?}", (x1, y1), (x2, y2), (x3, y3));
                                ans += 2;
                            }
                        }
                        {
                            let x3 = x1 as i64 - l / 2;
                            if x3 >= 0 as _ && y3 < h as _ && bd[y3 as usize][x3 as usize] == '#' {
                                // println!("{:?} {:?} {:?}", (x1, y1), (x2, y2), (x3, y3));
                                ans += 2;
                            }
                        }
                    } else {
                        // println!("** {:?} {:?}", (x1, y1), (x2, y2));

                        let l = (x1 as i64 - x2 as i64).abs() + (y1 as i64 - y2 as i64).abs();
                        let t = (x1 as i64 - x2 as i64).abs();
                        if l % 2 != 0 {
                            continue;
                        }

                        let u = 3 * l / 2 - t;
                        // println!("** {:?} {:?}, {} {} {}", (x1, y1), (x2, y2), l, u, t);
                        if l <= u {
                            continue;
                        }
                        let y3 = y1 as i64 + t;
                        let x3 = if x1 < x2 {
                            x1 as i64 + l - u
                        } else {
                            x1 as i64 - (l - u)
                        };

                        // println!("** {:?} {:?} {:?}", (x1, y1), (x2, y2), (x3, y3));

                        if x3 >= 0 as _ && y3 < h as _ && bd[y3 as usize][x3 as usize] == '#' {
                            // println!("{:?} {:?} {:?}", (x1, y1), (x2, y2), (x3, y3));
                            ans += 1;
                        }
                    }
                }
            }
        }
    }

    println!("{}", ans / 2);
}
