#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    
     
H, W = getIntList()
#print(N)
zs = []
for i in range(H):
    s = input()
    zs .append(s)

def iscoin( p0, p1):
    x = p0[0] + p1[0]
    if x<0 or x>= H: return False
    y = p0[1] + p1[1]
    if y<0 or y>= W: return False
    if zs[x][y] =='.': return False
    return True

res = 0
for i in range(2, 2*(H+W) //3+2, 2):
    za = []
    for a  in range(i+1):
        b = i - a
        za.append( (a,b) )
        if a:
            za.append( (-a,b) )
        if b:
            za.append( (a,-b) )
            if a:
                za.append( (-a,-b) )
    za.sort()
    nza = len(za)
    zt = []
    for i0 in range(nza):
        for i1 in range(i0+1, nza) :
            x0= za[i0]
            x1 = za[i1]
            d = abs(x0[0] - x1[0]) + abs(x0[1] - x1[1])
            if d== i:
                zt.append( (x0,x1) )
    #print(zt)
    for x in range(H):
        for y in range(W):
            if zs[x][y] =='.': continue
            for a,b  in zt:
                if not iscoin( (x,y), a ): continue
                if not iscoin( (x,y), b) : continue
                res +=1                

print(res//3)
