! 2020.2.9
!
      program answer
      implicit none
      integer :: N
      integer,allocatable,dimension(:) :: A
      integer :: i
      character(len=3) :: ans
!
      ans = 'YES'
      read(*,*) N
      allocate(A(N))
      read(*,*) (A(i),i=1,N)
!
      call quicksort(N,A,1,N)
      do i=1,N-1
        if(A(i) == A(i+1)) ans='NO'
      end do
!
      write(*,*) ans
!
      end program answer
!
!-------------------------------------------------
      recursive subroutine quicksort(n,x,l,r)
!-------------------------------------------------
! Variables I/O
!-------------------------------------------------
! n     ...  the number of data (IN) : integer
! x(i)  ...  data (INOUT) : integer
! l     ...  the smallest label in a sorted region
!            (compute label)
! r     ...  the largest label in a sorted region
!            (compute label)
!-------------------------------------------------
! Variables (The others)
!-------------------------------------------------
! c     ...  the average of l and r : (l+r)/2
! ls    ...  the smallest label in a sorted region
!            (Input label)
! i     ...  the largest label in a sorted region
!            (Input label)
!-------------------------------------------------
! Contain
!-------------------------------------------------
! Subroutine : swap(a,b) : swaping a for b
!-------------------------------------------------
      implicit none
      integer,intent(in) :: n,l,r
      integer,dimension(n),intent(inout) :: x
      integer :: c,ls,i
!
      if(l < r) then
        c = (l+r) / 2 ! representative value
        call swap(x(l),x(c))
        ls = l
        do i=l+1,r
          if(x(i) < x(l)) then
            ls = ls + 1
            call swap(x(ls),x(i))
          end if
        end do
        call swap(x(ls),x(l))
        call quicksort(n,x,l,ls-1)
        call quicksort(n,x,ls+1,r)
      end if
      contains
!-------------------------------------------------
      subroutine swap(a,b)
!-------------------------------------------------
        integer,intent(inout) :: a,b
        integer :: w
        w=a
        a=b
        b=w
      end subroutine swap
      end subroutine quicksort
!
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QQcl.594553 = linkonce local_unnamed_addr constant [3 x i8] c"YES"
@_QQcl.985df09ebf00383b080a3fa51bf5adf8 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2459/source.f\00"
@_QQcl.4E4F = linkonce local_unnamed_addr constant [2 x i8] c"NO"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca [3 x i8], align 2
  %3 = alloca i32, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(3) %2, ptr noundef nonnull align 1 dereferenceable(3) @_QQcl.594553, i64 3, i1 false)
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.985df09ebf00383b080a3fa51bf5adf8, i32 11)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %7 = load i32, ptr %3, align 4, !tbaa !3
  %8 = call i32 @llvm.smax.i32(i32 %7, i32 0)
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 2
  %11 = call ptr @malloc(i64 %10)
  store ptr %11, ptr @_QFEa.0, align 8, !tbaa !7
  %12 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.985df09ebf00383b080a3fa51bf5adf8, i32 13)
  %13 = load i32, ptr %3, align 4, !tbaa !3
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %15 = zext i32 %13 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %16 = phi i64 [ %21, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %.unpack107 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %sext = shl i64 %16, 32
  %17 = ashr exact i64 %sext, 32
  %18 = add nsw i64 %17, -1
  %19 = getelementptr i32, ptr %.unpack107, i64 %18
  %20 = call i1 @_FortranAioInputInteger(ptr %12, ptr %19, i32 4)
  %21 = add nuw nsw i64 %16, 1
  %exitcond.not = icmp eq i64 %16, %15
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %22 = call i32 @_FortranAioEndIoStatement(ptr %12)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  store i32 1, ptr %1, align 4, !tbaa !3
  call void @quicksort_(ptr nonnull %3, ptr %.unpack, ptr nonnull %1, ptr nonnull %3)
  %23 = load i32, ptr %3, align 4, !tbaa !3
  %24 = add i32 %23, -1
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph120, label %._crit_edge121

.lr.ph120:                                        ; preds = %._crit_edge
  %26 = zext i32 %24 to i64
  %27 = load i16, ptr @_QQcl.4E4F, align 1
  %28 = getelementptr inbounds [3 x [1 x i8]], ptr %2, i64 0, i64 2
  %xtraiter = and i64 %26, 1
  %29 = icmp eq i32 %24, 1
  br i1 %29, label %._crit_edge121.loopexit.unr-lcssa, label %.lr.ph120.new

.lr.ph120.new:                                    ; preds = %.lr.ph120
  %unroll_iter = and i64 %26, 4294967294
  br label %30

30:                                               ; preds = %47, %.lr.ph120.new
  %indvars.iv = phi i64 [ 1, %.lr.ph120.new ], [ %indvars.iv.next.1, %47 ]
  %niter = phi i64 [ 0, %.lr.ph120.new ], [ %niter.next.1, %47 ]
  %31 = add nsw i64 %indvars.iv, -1
  %32 = getelementptr i32, ptr %.unpack, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !3
  %indvars.iv.next = shl i64 %indvars.iv, 32
  %sext124 = add i64 %indvars.iv.next, 4294967296
  %34 = ashr exact i64 %sext124, 32
  %35 = add nsw i64 %34, -1
  %36 = getelementptr i32, ptr %.unpack, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !3
  %38 = icmp eq i32 %33, %37
  br i1 %38, label %.loopexit, label %39

.loopexit:                                        ; preds = %30
  store i16 %27, ptr %2, align 2
  store i8 32, ptr %28, align 2, !tbaa !3
  br label %39

39:                                               ; preds = %.loopexit, %30
  %40 = getelementptr i32, ptr %.unpack, i64 %indvars.iv
  %41 = load i32, ptr %40, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %sext124.1 = shl i64 %indvars.iv.next.1, 32
  %42 = ashr exact i64 %sext124.1, 32
  %43 = add nsw i64 %42, -1
  %44 = getelementptr i32, ptr %.unpack, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !3
  %46 = icmp eq i32 %41, %45
  br i1 %46, label %.loopexit.1, label %47

.loopexit.1:                                      ; preds = %39
  store i16 %27, ptr %2, align 2
  store i8 32, ptr %28, align 2, !tbaa !3
  br label %47

47:                                               ; preds = %.loopexit.1, %39
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge121.loopexit.unr-lcssa, label %30

._crit_edge121.loopexit.unr-lcssa:                ; preds = %47, %.lr.ph120
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph120 ], [ %indvars.iv.next.1, %47 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge121, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge121.loopexit.unr-lcssa
  %48 = add nsw i64 %indvars.iv.unr, -1
  %49 = getelementptr i32, ptr %.unpack, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !3
  %indvars.iv.next.epil = shl i64 %indvars.iv.unr, 32
  %sext124.epil = add i64 %indvars.iv.next.epil, 4294967296
  %51 = ashr exact i64 %sext124.epil, 32
  %52 = add nsw i64 %51, -1
  %53 = getelementptr i32, ptr %.unpack, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !3
  %55 = icmp eq i32 %50, %54
  br i1 %55, label %.loopexit.epil, label %._crit_edge121

.loopexit.epil:                                   ; preds = %.epil.preheader
  store i16 %27, ptr %2, align 2
  store i8 32, ptr %28, align 2, !tbaa !3
  br label %._crit_edge121

._crit_edge121:                                   ; preds = %._crit_edge121.loopexit.unr-lcssa, %.loopexit.epil, %.epil.preheader, %._crit_edge
  %56 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.985df09ebf00383b080a3fa51bf5adf8, i32 20)
  %57 = call i1 @_FortranAioOutputAscii(ptr %56, ptr nonnull %2, i64 3)
  %58 = call i32 @_FortranAioEndIoStatement(ptr %56)
  ret void
}

; Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
define void @quicksort_(ptr %0, ptr %1, ptr nocapture readonly %2, ptr nocapture readonly %3) local_unnamed_addr #1 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = load i32, ptr %2, align 4, !tbaa !3
  %8 = load i32, ptr %3, align 4, !tbaa !3
  %9 = icmp slt i32 %7, %8
  br i1 %9, label %10, label %61

10:                                               ; preds = %4
  %11 = add i32 %8, %7
  %12 = sdiv i32 %11, 2
  %13 = sext i32 %7 to i64
  %14 = add nsw i64 %13, -1
  %15 = getelementptr i32, ptr %1, i64 %14
  %narrow = add nsw i32 %12, -1
  %16 = sext i32 %narrow to i64
  %17 = getelementptr i32, ptr %1, i64 %16
  %18 = load i32, ptr %15, align 4, !tbaa !3
  %19 = load i32, ptr %17, align 4, !tbaa !3
  store i32 %19, ptr %15, align 4, !tbaa !3
  store i32 %18, ptr %17, align 4, !tbaa !3
  %20 = load i32, ptr %2, align 4, !tbaa !3
  %21 = add i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr %3, align 4, !tbaa !3
  %24 = sext i32 %23 to i64
  %25 = sub nsw i64 1, %22
  %26 = add nsw i64 %25, %24
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %10, %46
  %28 = phi i32 [ %47, %46 ], [ %20, %10 ]
  %29 = phi i64 [ %49, %46 ], [ %26, %10 ]
  %30 = phi i32 [ %48, %46 ], [ %21, %10 ]
  %.012 = phi i32 [ %.1, %46 ], [ %20, %10 ]
  %31 = sext i32 %30 to i64
  %32 = add nsw i64 %31, -1
  %33 = getelementptr i32, ptr %1, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !3
  %35 = sext i32 %28 to i64
  %36 = add nsw i64 %35, -1
  %37 = getelementptr i32, ptr %1, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !3
  %39 = icmp slt i32 %34, %38
  br i1 %39, label %40, label %46

40:                                               ; preds = %.lr.ph
  %41 = add i32 %.012, 1
  %42 = sext i32 %41 to i64
  %43 = add nsw i64 %42, -1
  %44 = getelementptr i32, ptr %1, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !3
  store i32 %34, ptr %44, align 4, !tbaa !3
  store i32 %45, ptr %33, align 4, !tbaa !3
  %.pre = load i32, ptr %2, align 4, !tbaa !3
  br label %46

46:                                               ; preds = %40, %.lr.ph
  %47 = phi i32 [ %.pre, %40 ], [ %28, %.lr.ph ]
  %.1 = phi i32 [ %41, %40 ], [ %.012, %.lr.ph ]
  %48 = add i32 %30, 1
  %49 = add nsw i64 %29, -1
  %50 = icmp sgt i64 %29, 1
  br i1 %50, label %.lr.ph, label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %46
  %.pre14 = add i32 %.1, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %10
  %.pre-phi = phi i32 [ %.pre14, %._crit_edge.loopexit ], [ %21, %10 ]
  %51 = phi i32 [ %47, %._crit_edge.loopexit ], [ %20, %10 ]
  %.0.lcssa = phi i32 [ %.1, %._crit_edge.loopexit ], [ %20, %10 ]
  %52 = sext i32 %.0.lcssa to i64
  %53 = add nsw i64 %52, -1
  %54 = getelementptr i32, ptr %1, i64 %53
  %55 = sext i32 %51 to i64
  %56 = add nsw i64 %55, -1
  %57 = getelementptr i32, ptr %1, i64 %56
  %58 = load i32, ptr %54, align 4, !tbaa !3
  %59 = load i32, ptr %57, align 4, !tbaa !3
  store i32 %59, ptr %54, align 4, !tbaa !3
  store i32 %58, ptr %57, align 4, !tbaa !3
  %60 = add i32 %.0.lcssa, -1
  store i32 %60, ptr %6, align 4, !tbaa !3
  call void @quicksort_(ptr %0, ptr nonnull %1, ptr nonnull %2, ptr nonnull %6)
  store i32 %.pre-phi, ptr %5, align 4, !tbaa !3
  call void @quicksort_(ptr %0, ptr nonnull %1, ptr nonnull %5, ptr nonnull %3)
  br label %61

61:                                               ; preds = %._crit_edge, %4
  ret void
}

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @_QFquicksortPswap(ptr nocapture %0, ptr nocapture %1) local_unnamed_addr #2 {
  %3 = load i32, ptr %0, align 4, !tbaa !3
  %4 = load i32, ptr %1, align 4, !tbaa !3
  store i32 %4, ptr %0, align 4, !tbaa !3
  store i32 %3, ptr %1, align 4, !tbaa !3
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nofree nosync nounwind memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
