program equilateral
  implicit none
  integer :: h, w, a(0:600,0:600) = 0, i, j, k, d
  integer :: x(0:600,0:600) = 0, y(0:600,0:600) = 0
  integer(8) :: ans = 0_8
  character(300) :: s
  read(*,*) h, w
  do i = 1, h
    read(*,*) s
    s = trim(adjustl(s))
    do j = 1, w
      if (s(j:j) == "#") a(i+j-1,i-j+w) = 1
    end do
  end do
  do i = 1, h+w
    do j = 1, h+w
      x(i,j) = x(i,j-1)+a(i,j)
      y(i,j) = y(i-1,j)+a(i,j)
    end do
  end do
  do i = 0, h+w
    do j = 0, h+w
      do k = j+1, h+w
        d = k-j
        if (a(i,j)*a(i,k) == 1) then
          if (i-d >= 0) ans = ans+int(x(i-d,k)-x(i-d,j-1)-a(i-d,k)-a(i-d,j),8)
          if (i+d <= h+w) ans = ans+int(x(i+d,k)-x(i+d,j-1)-a(i+d,k)-a(i+d,j),8)
        end if
        if (a(j,i)*a(k,i) == 1) then
          if (i-d >= 0) ans = ans+int(y(k,i-d)-y(j-1,i-d),8)
          if (i+d <= h+w) ans = ans+int(y(k,i+d)-y(j-1,i+d),8)
        end if
      end do
    end do
  end do
  write(*,'(i0)') ans
  stop
end program equilateral