Problem:
Score : 300 points

Problem Statement

Given is a sequence of integers A_1, A_2, ..., A_N.
If its elements are pairwise distinct, print YES; otherwise, print NO.

Constraints

2 ≤ N ≤ 200000

1 ≤ A_i ≤ 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

If the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.

Sample Input 1

5
2 6 1 4 5

Sample Output 1

YES

The elements are pairwise distinct.

Sample Input 2

6
4 1 3 1 6 2

Sample Output 2

NO

The second and fourth elements are identical.

Sample Input 3

2
10000000 10000000

Sample Output 3

NO

Solution in Fortran (gfortran v4.8.4) (judge verdict: Accepted)

subroutine heapsort(n,array)                                                                               
  implicit none
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)

  integer ::i,k,j,l
  double precision :: t

  if(n.le.0)then
     write(6,*)"Error, at heapsort"; stop
  endif
  if(n.eq.1)return

  l=n/2+1
  k=n
  do while(k.ne.1)
     if(l.gt.1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k.eq.1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j.le.k)
        if(j.lt.k)then
           if(array(j).lt.array(j+1))j=j+1
        endif
        if (t.lt.array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo

  return
end subroutine heapsort

program Beg3
  implicit none
  integer :: N, i, j
  integer, allocatable :: A(:)


  read(*,*) N
  allocate(A(N))
  read(*,*) (A(i), i=1,N)

  call heapsort(N,A)

  do i=1,N-1
     if(A(i).eq.A(i+1)) goto 500
  enddo


  print*, 'YES'
  stop

  500 print *, 'NO'



end program Beg3