import numpy as np
(H,W) = map(int,input().split())
field = -np.ones((H,W),dtype=np.int)
points = []
i = 0
for h in range(H):
    line = input()
    for w in range(W):
        if line[w] == '#':
            points.append((h,w))
            field[h,w] = i
            i = i+1

points = np.array(points)
N = len(points)

answer = 0
for m in range(N):
    for n in range(m,N):
        p1 = points[m]
        p2 = points[n]
        (dy, dx) = p2 - p1
        distance = np.abs([dy,dx]).sum()
        if distance % 2:
            continue

        if dx < 0:
            dx = -dx
            s = -1
        else:
            s = 1
        
        if dx > dy:
            p3s = np.array([ p1 + [ (dx+3*dy)//2, s*(dx-dy)//2 ]])
        elif dx < dy:
            p3s = np.array([ p1 + [ (-dx+dy)//2, s*(3*dx+dy)//2 ]])
        else: # dx == dy
            p3s = np.array([ p1 + [ dx + u, s*(-dx + u) ] for u in range(dx+1) ])

        for p in p3s:
            if (0<=p[0]<H) and (0<=p[1]<W) and (field[p[0],p[1]]>n):
                answer = answer + 1

print(answer)