CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
src = list(map(int, input().split()))

sum1 = sum2 = src[0]
op1 = op2 = 0
if sum1 < 1:
    op1 += (1 - sum1)
    sum1 = 1
if sum2 > -1:
    op2 += (sum2 + 1)
    sum2 = -1

for i in range(1,N):
    if i%2 == 1:
        if sum1 + src[i] > -1:
            op1 += (sum1 + src[i] + 1)
            sum1 = -1
        else:
            sum1 += src[i]
        if sum2 + src[i] < 1:
            op2 += (1 - sum2 - src[i])
            sum2 = 1
        else:
            sum2 += src[i]
    else:
        if sum2 + src[i] > -1:
            op2 += (sum2 + src[i] + 1)
            sum2 = -1
        else:
            sum2 += src[i]
        if sum1 + src[i] < 1:
            op1 += (1 - sum1 - src[i])
            sum1 = 1
        else:
            sum1 += src[i]

print((min(op1,op2)))


# Optimized solution
N = int(eval(input()))
src = list(map(int,input().split()))

cum1 = cum2 = 0
ans1 = ans2 = 0
for i,a in enumerate(src):
    cum1 += a
    cum2 += a
    if i%2:
        if cum1 >= 0:
            ans1 += cum1+1
            cum1 = -1
        if cum2 <= 0:
            ans2 += 1-cum2
            cum2 = 1
    else:
        if cum1 <= 0:
            ans1 += 1-cum1
            cum1 = 1
        if cum2 >= 0:
            ans2 += cum2+1
            cum2 = -1

print((min(ans1,ans2)))
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

ans1 = c = 0
for i,a in enumerate(A):
    c += a
    if i%2:
        if c < 1:
            ans1 += 1-c
            c = 1
    else:
        if c > -1:
            ans1 += c+1
            c = -1

ans2 = c = 0
for i,a in enumerate(A):
    c += a
    if i%2==0:
        if c < 1:
            ans2 += 1-c
            c = 1
    else:
        if c > -1:
            ans2 += c+1
            c = -1

print((min(ans1,ans2)))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))

ans1 = 0
s = 0
for i,a in enumerate(A):
    s += a
    if i%2:
        if s > -1:
            ans1 += s+1
            s = -1
    else:
        if s < 1:
            ans1 += 1-s
            s = 1

ans2 = 0
s = 0
for i,a in enumerate(A):
    s += a
    if i%2==0:
        if s > -1:
            ans2 += s+1
            s = -1
    else:
        if s < 1:
            ans2 += 1-s
            s = 1

print((min(ans1, ans2)))
# Original solution
def f(flg, an):
    accum = 0
    ret = 0
    for i, ai in enumerate(an):
        accum += ai
        if i % 2:
            if flg and 0 <= accum:
                ret += accum + 1
                accum = -1
            elif not flg and accum <= 0:
                ret += -accum + 1
                accum = 1
        else:
            if flg and accum <= 0:
                ret += -accum + 1
                accum = 1
            elif not flg and 0 <= accum:
                ret += accum + 1
                accum = -1

    return ret


def main():
    n, *an = list(map(int, open(0).read().split()))
    print((min(f(0, an), f(1, an))))
    return


main()


# Optimized solution
def f(flg, an):
    accum = 0
    ret = 0
    for i, ai in enumerate(an):
        accum += ai
        if flg:
            flg = False
            if accum <= 0:
                ret += -accum + 1
                accum = 1
        else:
            flg = True
            if 0 <= accum:
                ret += accum + 1
                accum = -1
    return ret


def main():
    n, *an = list(map(int, open(0).read().split()))
    print((min(f(False, an), f(True, an))))
    return


main()
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))

b=a[:]
for i in range(n):
    if i%2:b[i]=min(-sum(b[j] for j in range(i))-1,b[i])
    else: b[i]=max(-sum(b[j] for j in range(i))+1,b[i])
s=sum(abs(b[i]-a[i]) for i in range(n))

c=a[:]
for i in range(n):
    if i%2:c[i]=max(-sum(c[j] for j in range(i))+1,c[i])
    else: c[i]=min(-sum(c[j] for j in range(i))-1,c[i])
t=sum(abs(c[i]-a[i]) for i in range(n))

print((min(s,t)))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

s1=c1=s2=c2=0
for i in range(n):
    if i%2:
        c1+=max(0,a[i]+s1+1); s1+=min(-s1-1,a[i])
        c2+=max(0,-s2+1-a[i]); s2+=max(-s2+1,a[i])
    else:
        c1+=max(0,-s1+1-a[i]); s1+=max(-s1+1,a[i])
        c2+=max(0,a[i]+s2+1); s2+=min(-s2-1,a[i])
print((min(c1,c2)))
# Original solution
import itertools
n = int(eval(input()))
a = list(map(int,input().split()))
sum = list(itertools.accumulate(a))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i in range(n):
    s = sum[i] + dif1
    t = sum[i] + dif2
    if i%2==0:
        if s<1:
            dif1 += 1 - s
            res1 += 1 - s
        if t>-1:
            dif2 -= 1 + t
            res2 += 1 + t
    else:
        if s>-1:
            dif1 -= 1 + s
            res1 += 1 + s
        if t<1:
            dif2 += 1 - t
            res2 += 1 - t
    #print(dif1,res1,dif2,res2)
print((min(res1,res2)))
#print(res1,res2)


# Optimized solution
import itertools
n = int(eval(input()))
a = list(map(int,input().split()))
#'+-+-...'と'-+-+...'でそれぞれ求める
res1 = 0
res2 = 0
dif1 = 0
dif2 = 0
for i,j in enumerate(itertools.accumulate(a)):
    s = j + dif1
    t = j + dif2
    if i%2==0:
        if s<1:
            dif1 += 1 - s
            res1 += 1 - s
        if t>-1:
            dif2 -= 1 + t
            res2 += 1 + t
    else:
        if s>-1:
            dif1 -= 1 + s
            res1 += 1 + s
        if t<1:
            dif2 += 1 - t
            res2 += 1 - t
print((min(res1,res2)))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
s = []
for i in range(n):
    s.append(sum(a[0:i+1]))

count = 0
ans1 = 0
for i in range(n):
    if i%2 == 0:
        if s[i]+count > 0:
            continue
        else:
            ans1 += 1-(s[i]+count)
            count += 1-(s[i]+count)
    else:
        if s[i]+count < 0:
            continue
        else:
            ans1 += (s[i]+count) + 1
            count -= (s[i]+count) + 1
            
count1 = 0
ans2 = 0
for i in range(n):
    if i%2 == 1:
        if s[i]+count1 > 0:
            continue
        else:
            ans2 += 1-(s[i]+count1)
            count1 += 1-(s[i]+count1)
    else:
        if s[i]+count1 < 0:
            continue
        else:
            ans2 += (s[i]+count1) + 1
            count1 -= (s[i]+count1) + 1
            
print((min(ans1,ans2)))
            

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
s = []
for i in range(n):
    if i == 0:
        s.append(a[0])
    else:
        s.append(a[i]+s[-1])

count = 0
ans1 = 0
for i in range(n):
    if i%2 == 0:
        if s[i]+count > 0:
            continue
        else:
            ans1 += 1-(s[i]+count)
            count += 1-(s[i]+count)
    else:
        if s[i]+count < 0:
            continue
        else:
            ans1 += (s[i]+count) + 1
            count -= (s[i]+count) + 1
            
count1 = 0
ans2 = 0
for i in range(n):
    if i%2 == 1:
        if s[i]+count1 > 0:
            continue
        else:
            ans2 += 1-(s[i]+count1)
            count1 += 1-(s[i]+count1)
    else:
        if s[i]+count1 < 0:
            continue
        else:
            ans2 += (s[i]+count1) + 1
            count1 -= (s[i]+count1) + 1
            
print((min(ans1,ans2)))
# Original solution
# -*- coding: utf-8 -*-

n = int(eval(input()))
a = list(map(int, input().split()))


def solve(bl):
    if bl:
        tmp = -1
    else:
        tmp = 0
    sm = 0
    cnt = 0
    for i, ele in enumerate(a):
        sm += ele
        if i % 2 + tmp:
            if sm < 1:
                cnt += 1 - sm
                sm = 1
        else:
            if sm > -1:
                cnt += sm + 1
                sm = -1

    return cnt


ans = min(solve(True), solve(False))
print(ans)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

sm = a[0]


def f(sm):
    ret = 0
    for e in a[1:]:
        if sm * (sm + e) < 0:
            sm += e
            continue

        else:
            if sm > 0:
                a_mx = -sm - 1
                ret += e - a_mx
                sm += a_mx
            else:
                a_mn = -sm + 1
                ret += a_mn - e
                sm += a_mn

    return ret


if sm > 0:
    ans = min(f(sm), f(-1) + sm + 1)
elif sm < 0:
    ans = min(f(sm), f(1) - sm + 1)
else:
    ans = min(f(1), f(-1)) + 1

print(ans)
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
b = a[:]
s1 = s2 = 0
for i in range(n):
  c = sum(a[0:i+1])
  if (i % 2 == 0 and c <= 0):
    s1 += abs(c) + 1
    a[i] += abs(c) + 1
  elif(i % 2 == 1 and c >= 0):
    s1 += abs(c) + 1
    a[i] -= abs(c) + 1
for i in range(n):
  c = sum(b[0:i+1])
  if (i % 2 == 0 and c >= 0):
    s2 += abs(c) + 1
    b[i] -= abs(c) + 1
  elif (i % 2 == 1 and c <= 0):
    s2 += abs(c) + 1
    b[i] += abs(c) + 1
print((min(s1,s2)))

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
s1 = s2 = su = 0
for i in range(n):
  su += a[i]
  if (i % 2 == 0 and su <= 0):
    s1 += abs(su) + 1
    su = 1
  elif(i % 2 == 1 and su >= 0):
    s1 += abs(su) + 1
    su = -1
su = 0
for i in range(n):
  su += a[i]
  if (i % 2 == 0 and su >= 0):
    s2 += abs(su) + 1
    su = -1
  elif (i % 2 == 1 and su <= 0):
    s2 += abs(su) + 1
    su = 1
print((min(s1,s2)))
# Original solution
n = int(eval(input()))
an = list(map(int, input().split()))

sum_an = []
tmp = 0
for a in an:
    tmp += a
    sum_an.append(tmp)

c = 0
before_positive = sum_an[0] <= 0
for i in range(n):
    if before_positive and sum_an[i] >= 0:
        p = abs(sum_an[i]) + 1
        c += p
        for j in range(i, n):
            sum_an[j] -= p
        before_positive = False
    elif not before_positive and sum_an[i] <= 0:
        p = abs(sum_an[i]) + 1
        c += p
        for j in range(i, n):
            sum_an[j] += p
        before_positive = True
    else:
        before_positive = not before_positive

print(c)


# Optimized solution
n = int(eval(input()))
an = list(map(int, input().split()))

c1 = 0
c2 = 0
sum1 = 0 # 偶数番目が正
sum2 = 0 # 奇数番目が正
for i in range(n):
    sum1 += an[i]
    sum2 += an[i]
    if i%2 == 0:
        if sum1 <= 0:
            p = abs(sum1) + 1
            c1 += p
            sum1 += p
        if sum2 >= 0:
            p = abs(sum2) + 1
            c2 += p
            sum2 -= p
    else:
        if sum1 >= 0:
            p = abs(sum1) + 1
            c1 += p
            sum1 -= p
        if sum2 <= 0:
            p = abs(sum2) + 1
            c2 += p
            sum2 += p

print((min(c1, c2)))
# Original solution
def c_Sequence(N, A):
    total = 0  # 変化量の総量
    tmp1 = 0  # 条件を満たすために今見ている項をどれだけ変化させるか
    for i in range(N):
        total += A[i]
        # 奇数番目を正に、偶数番目を負にする(0-indexedで)
        if i % 2 == 0:
            if total >= 0:
                tmp1 += abs(-1 - total)
                total -= abs(-1 - total)
        else:
            if total <= 0:
                tmp1 += 1 - total
                total += 1 - total

    total = 0
    tmp2 = 0
    for i in range(N):
        total += A[i]
        # 奇数番目を負に、偶数番目を正にする
        if i % 2 == 0:
            if total <= 0:
                tmp2 += 1 - total
                total += 1 - total
        else:
            if total >= 0:
                tmp2 += abs(-1 - total)
                total -= abs(-1 - total)
    ans = min(tmp1, tmp2)
    return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_Sequence(N, A)))

# Optimized solution
def c_sequence():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]

    def solver(sign):
        ret, total = 0, 0
        for a in A:
            total += a
            if sign * total <= 0:
                ret += abs(sign - total)  # 総和がsignになるまでaを変化させる
                total = sign
            sign *= -1
        return ret
    # 1: 奇数番目を正、偶数番目を負にする場合。 -1: その逆
    return min(solver(1), solver(-1))

print((c_sequence()))
# Original solution
n = int(eval(input()))
A = list(map(int,input().split()))
cnt = 0
for i in range(1,n):
  if A[0] >= 0:
    if i%2!=0 and A[i]>=0:
      cnt += A[i]
      A[i] -= A[i]
      while sum(A[:i+1])>=0:
        A[i] -= 1
        cnt += 1
    elif i%2==0 and A[i]<0:
      cnt += abs(A[i])
      A[i] += abs(A[i])
      while sum(A[:i+1])<=0:
        A[i] += 1
        cnt += 1
    else:
      if A[i] >= 0:
        while sum(A[:i+1])<=0:
          A[i] += 1
          cnt += 1
      else:
        while sum(A[:i+1])>=0:
          A[i] -= 1
          cnt += 1
  else:
    if i%2!=0 and A[i]<0:
      cnt += abs(A[i])
      A[i] += abs(A[i])
      while sum(A[:i+1])<=0:
        A[i] += 1
        cnt += 1
    elif i%2==0 and A[i]>=0:
      cnt += A[i]
      A[i] -= A[i]
      while sum(A[:i+1])>=0:
        A[i] -= 1
        cnt += 1
    else:
      if A[i] >= 0:
        while sum(A[:i+1])<=0:
          A[i] += 1
          cnt += 1
      else:
        while sum(A[:i+1])>=0:
          A[i] -= 1
          cnt += 1  
print(cnt)

# Optimized solution
n = eval(input())
a = [int(i) for i in input().split()]
def chk(a, t):
  ans = 0
  x = 0
  for i in a:
    x += i
    if t == True and x < 1:
      ans+=1-x
      x=1
    elif t == False and x>-1:
      ans+=x+1
      x=-1
    t=not t
  return ans
print((min(chk(a,True),chk(a,False))))
# Original solution
def main():
    import sys
    input = sys.stdin.readline

    n = int(eval(input()))
    a = list(map(int, input().split()))
    A = []
    A_append = A.append
    cnt = 0

    for i in range(n-1):
        A_append((a[i]))
        x = sum(A)
        if x > 0 and x + a[i+1] > 0:
            y = -(x + a[i+1] + 1)
            cnt -= y
            a[i+1] += y

        elif x < 0 and x + a[i+1] < 0:
            y = -(x - a[i+1]+ 1)
            cnt += y
            a[i+1] += y

    if sum(a) == 0:
        cnt += 1

    print(cnt)

if __name__ == '__main__':
    main()

# Optimized solution
n = eval(input())
A = list(map(int, input().split()))

def Chk(a, pos):
    cnt = 0
    tmp = 0

    for a in A:
        tmp += a

        if pos and tmp < 1:
            cnt += 1 - tmp
            tmp = 1
        elif not pos and tmp > -1:
            cnt += 1 + tmp
            tmp = -1

        pos = not pos
    return cnt

print((min(Chk(A, True), Chk(A, False))))
# Original solution
n=int(eval(input()))
count=0
A=[int(i) for i in input().split()]
if A[0]==0:
  A[0]+=1
  count+=1
elif A[0]<0:
  for i in range(len(A)):
    A[i]*=(-1)
for i in range(1,len(A)):
  s=sum(A[:i+1])
  if i%2==0:
    if s<=0:
      A[i]+=1-s
      count+=1-s
  else:
    if s>=0:
      A[i]-=1+s
      count+=1+s
print(count)

# Optimized solution
n=eval(input())
a=[int(i) for i in input().split()]
def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans
print((min(chk(a,True),chk(a,False))))
# Original solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

def f(A, op, acc = 0, cnt = 0):
    for i in range(n):
        acc += A[i]
        
        if i % 2 == 0 and acc * op >= 0:
            cnt += op * acc + 1
            acc = - op
            
        if i % 2 == 1 and acc * op <= 0:
            cnt += - op * acc + 1
            acc = op
            
    if acc == 0:
        cnt += 1
        
    return cnt
        
print((min(f(A, -1), f(A, 1))))

# Optimized solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

def f(A, op, acc = 0, cnt = 0):
    for i in range(n):
        acc += A[i]
        
        if i % 2 == 0 and op * acc <= 0:
            cnt += - op * acc + 1
            acc = op
                
        if i % 2 == 1and op * acc >= 0:
            cnt += op * acc + 1
            acc = -op
                
    if acc == 0:
        cnt += 1
        
    return cnt

print((min(f(A, 1), f(A, -1))))
# Original solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

ans = 0
cnt = 0
for i in range(n):
    if i % 2 == 0:
        if cnt + A[i] < 0:
            cnt += A[i]
        else:
            ans += abs(cnt + A[i] - (-1))
            cnt = -1
    else:
        if cnt + A[i] > 0:
            cnt += A[i]
        else:
            ans += abs(cnt + A[i] - 1)
            cnt = 1
            
ans2 = 0
cnt2 = 0
for i in range(n):
    if i % 2 == 1:
        if cnt2 + A[i] < 0:
            cnt2 += A[i]
        else:
            ans2 += abs(cnt2 + A[i] - (-1))
            cnt2 = -1
    else:
        if cnt2 + A[i] > 0:
            cnt2 += A[i]
        else:
            ans2 += abs(cnt2 + A[i] - 1)
            cnt2 = 1
                
print((min(ans, ans2)))

# Optimized solution
n = int(eval(input()))
A = [int(i) for i in input().split()]

def f(x):
    ans = 0
    cnt = 0
    for i in range(n):
        if i % 2 == x:
            if cnt + A[i] < 0:
                cnt += A[i]
            else:
                ans += abs(cnt + A[i] - (-1))
                cnt = -1
        else:
            if cnt + A[i] > 0:
                cnt += A[i]
            else:
                ans += abs(cnt + A[i] - 1)
                cnt = 1
    return ans

print((min(f(0), f(1))))
# Original solution
import collections
N=int(eval(input()))
A=list(map(int,input().split()))
c = collections.Counter(A)
for i in range(N):
  if list(c.values())[i]>1:
    print('NO')
    exit()
print('YES')

# Optimized solution
import collections
N=int(eval(input()))
A=list(map(int,input().split()))
li=list(collections.Counter(A).values())
for i in range(len(li)):
  if li[i]>1:
    print('NO')
    exit()
print('YES')
# Original solution
def hantei(n,data):
    for x in range(n-1):
        for y in range(x+1,n):
            if data[x] == data[y]:
                return "NO"

    return "YES"

n = int(eval(input()))
data = [int(x) for x in input().split()]
print((hantei(n,data)))


# Optimized solution
def hantei(n,data):
    data.sort()
    for x in range(n-1):
        if data[x] == data[x+1]:
                return "NO"
    return "YES"

n = int(eval(input()))
data = [int(x) for x in input().split()]

print((hantei(n,data)))
# Original solution
n=int(eval(input()))
l=input().split()
q=[]
f=1
for i in l:
  if i not in q:
    q.append(i)
  else:
    f=0
    break
if f==1:
  print('YES')
else:
  print('NO')



# Optimized solution
n=int(eval(input()))
l=input().split()
l.sort()
flag=1
for i in range(n-1):
  if l[i]==l[i+1]:flag=0
if flag==1:print("YES")
else:print("NO")
# Original solution
l=int(eval(input()))
list = list(map(int, input().split()))

i=0
r="YES"

while(i<l):
  j=i+1
  while(j<l):
    if(list[i]==list[j]):
      r="NO"
    j+=1
  i+=1

print(r)

# Optimized solution
l=int(eval(input()))
list = list(map(int, input().split()))

def has_duplicates(seq):
    return len(seq) != len(set(seq))

r=has_duplicates(list)

if(str(r)=="False"):
  print("YES")
else:
  print("NO")
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
s="YES"
for i in range(n):
    for j in range(i+1,n):
        if a[i]==a[j]:
            s="NO"
            break
print(s)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
s="YES"
for i in range(n-1):
    if a[i]==a[i+1]:
        s="NO"
        break
print(s)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0 for _ in range(max(a)+1)]
for i in range(n):
  if l[a[i]] == 0:
    l[a[i]] += 1
  else:
    print('NO')
    break
else:
  print('YES')

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
if len(a) != len(set(a)):
  print('NO')
else:
  print('YES')
# Original solution
eval(input())
l=input().split()
for i in l:
  if l.count(i)!=1:
    print("NO")
    exit(0)
print("YES")

# Optimized solution
N=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
for i in range(N-1):
  if a[i]==a[i+1]:
    print("NO")
    exit(0)
print("YES")
# Original solution
n = eval(input())
a = input().split()
n = int(n)
a = [int(s) for s in a]
s =0

for f in range(n):
  ai = a[f]
  for g in range(n):
    if g != f:
        if ai == a[g]:
            s = s+1

if s>0: print("NO")
else: print('YES')

# Optimized solution
n = eval(input())
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")
# Original solution
n = eval(input())
N = int(n)
a = input().split()
A = list(map(int, a))

c = 0
for i in range(N):
    for j in range(i + 1, N):
        if A[i] == A[j]:
            print("NO")
            c += 1
            break
if c == 0:
    print("YES")

# Optimized solution
n = eval(input())
N = int(n)
a = input().split()
A = list(map(int, a))

b = set(A)
B = list(map(int, b))

if len(A) == len(B):
    print("YES")
else:
    print("NO")
# Original solution
N=int(eval(input()))
a=list(map(int,input().split()))
p=0
for i in range(N-1):
	for j in range(i+1,N):
		if a[i]==a[j]:
			p=1
if p==0:
	print('YES')
else:
	print('NO')

# Optimized solution
N=int(eval(input()))
a=list(map(int,input().split()))
a=sorted(a)
p=0
for i in range(N-1):
	if a[i]==a[i+1]:
		p=1
if p==0:
	print('YES')
else:
	print('NO')
# Original solution
n=input().split()
li=[]
a=list(map(int,input().split()))
flag=0

for i in a:
    if i in li:
        print("NO")
        flag=1
        break
    else:
        li.append(i)

if flag==0:
    print("YES")

# Optimized solution
n=input().split()
li=[]
a=list(map(int,input().split()))

p=set(a)

if len(a)==len(p):
    print("YES")
else:
    print("NO")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

answer = 'YES'
for i in range(N):
    c = A.count(A[i])
    if c >= 2:
        answer = 'NO'
        break

print(answer)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

answer = 'YES'
AA = sorted(A)
for i in range(N - 1):
    if AA[i] == AA[i + 1]:
        answer = 'NO'
        break

print(answer)
# Original solution
import sys
input = sys.stdin.readline


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    for i in range(N):
        for j in range(i+1, N):
            if A[i] == A[j]:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    main()


# Optimized solution
import sys
input = sys.stdin.readline


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    A.sort()
    for i in range(1, N):
        if A[i-1] == A[i]:
            print("NO")
            exit()
    print("YES")


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

isDiff = True
cache = [0] * n 

for i in range(n) :

    for j in range(n) :
        if i == j :
            continue

        if cache[j] == -1 :
            continue

        if a[i] == a[j] :
            isDiff = False
            break

    cache[i] = -1


if isDiff :
    print('YES')
else :
    print('NO')


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

aa = set(a)

if len(a) == len(aa) :
    print('YES')
else :
    print('NO')
# Original solution
flag = True
n = int(eval(input()))

a = input().split()

if n != len(a):
    print("error")

start = 0
for i in a:
    start += 1
    for j in a[start:]:
        if i == j:
            flag = False
            break
    
            
if flag:
    print('YES')
else:
    print('NO')

# Optimized solution
flag = True
n = int(eval(input()))

a = input().split()

a.sort()
start = 0
for i in a:
    for j in a[start-1:start+1:2]:
        if i == j:
            flag = False
            break
    start += 1
    
if flag:
    print('YES')
else:
    print('NO')
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]

a.sort()
for i in range(n-1):
    if a[i] == a[i+1]:
        print("NO")
        exit()

print("YES")

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]

aset = set(a)
print(("YES" if len(a) == len(aset) else "NO"))