g=*$<;a=*0...g.size;p=a.product(a).select{|x,y|g[y][x]==?#}
p p.combination(2).count{|(x,y),(a,b)|u,v=a-x,b-y;p.include?([a-v,b+u])&&p.include?([x-v,y+u])}/2