import math
(h, w) = map(int, input().split())
s = []

def ran(s1, s2):
    return abs(s1[0] - s2[0]) + abs(s1[1] - s2[1])

for i in range(h):
    tmp = list(input())
    for j in range(w):
        if tmp[j] == '#':
            s.append([i, j])
count = 0
for i in range(len(s) - 2):
    for j in range(i + 1, len(s) - 1):
        for k in range(j + 1, len(s)):
            si = s[i]
            sj = s[j]
            sk = s[k]

            ranij = ran(si, sj)
            ranjk = ran(sj, sk)
            ranik = ran(si, sk)
            if ranij == ranjk and ranij == ranik and ranik == ranjk:
                count += 1

print(count)