g=STDIN.read.split
l=g.size
p l.times.sum{|i|l.times.find_all{g[i][_1]==?#}.combination(2).count{b,c=_1;(d=c-b+i)<l&&(a=g[d][b])==g[d][c]&&a==?#}}