program main implicit none integer::N,i,kankaku,tmp integer,allocatable::x(:) integer::memo(0:10**8) integer::min1,min2 data memo/100000001*0/ read *, N allocate(x(N)) read *, x min1 = MIN(x(1),x(2)) min2 = MAX(x(1),x(2)) if(min1.eq.min2) then print '(a)', "NO" return end if do i=3,N memo(x(i)) = 1 if(min1.gt.x(i)) then min2 = min1 min1 = x(i) else if(min2.gt.x(i)) then min2 = x(i) end if end do kankaku = min2 - min1 tmp = min1 + kankaku*2 do i=3,N-1 if(memo(tmp).ne.0) then print '(a)', "NO" return end if end do print '(a)', "YES" end program