program BannedK
  implicit none

  integer :: n, i, j, k, s
  integer, allocatable :: a(:)

  read *, n
  allocate(a(n))
  read *, a

  do k = 1, n
     s = 0
     do i = 1, n-1
        do j = i+1, n
           if (i /= k .and. j /= k .and. a(i) == a(j)) then
              s = s + 1
           end if
        end do
     end do
     print *, s
  end do

  stop
end program BannedK



  
