Harryxun/stf_run huggingface dataset:
N=int(input())
a=list(map(int,input().split()))

MAX=max(a)
MIN=min(a)
m=0
operation=[]
if abs(MAX)>=abs(MIN):
    n=a.index(MAX)
    for i in range(N):
        a[i]+=MAX
        m+=1
        operation.append([n+1,i+1])
    for i in range(N-1):
        a[i+1]+=a[i]
        m+=1
        operation.append([i+2,i+1])
else:
    n=a.index(MIN)
    for i in range(N):
        a[i]+=MIN
        m+=1
        operation.append([n+1,i+1])
    for i in range(N,0,-1):
        a[i-1]+=a[i]
        m+=1
        operation.append([i+1,i])

print(m)
for i in range(m):
    print(*operation[i])

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))

MAX=max(a)
MIN=min(a)
m=0
operation=[]
if abs(MAX)>=abs(MIN):
    n=a.index(MAX)
    for i in range(N):
        a[i]+=MAX
        m+=1
        operation.append([n+1,i+1])
    for i in range(N-1):
        a[i+1]+=a[i]
        m+=1
        operation.append([i+1,i+2])
else:
    n=a.index(MIN)
    for i in range(N):
        a[i]+=MIN
        m+=1
        operation.append([n+1,i+1])
    for i in range(N-1,0,-1):
        a[i-1]+=a[i]
        m+=1
        operation.append([i+1,i])

print(m)
for i in range(m):
    print(*operation[i])
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

total = 0
for a in A:
    total += a

for m in range(M):
    if (A[m] * 4 * M < total):
        print("No")
        exit(1)

print("Yes")


### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
 
A.sort(reverse=True)
 
total = 0
for a in A:
    total += a

word = "Yes"
for m in range(M):
    if (A[m] * 4 * M < total):
        word = "No"
 
print(word)
n = int(input())
d,x = map(int,input().split())
a = []
for i in range(n):
    a.append(int(int(input())))

for i in range(n):
    num.append((d - 1) // a[i] + 1)
#print(num)

ans = x
for i in range(n):
    ans += num[i]
print(ans)

### FIXED CODE ###

n = int(input())
d,x = map(int,input().split())
a = []
for i in range(n):
    a.append(int(int(input())))

num = []
for i in range(n):
    num.append(0)

for i in range(n):
    num[i] = (d - 1) // a[i] + 1
#print(num)

ans = x
for i in range(n):
    ans += num[i]
print(ans)
from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
 
# sys.stdin = open('input')
 
def inp(force_list=False):
    re = map(int, raw_input().split())
    if len(re) == 1 and not force_list:
        return re[0]
    return re
 
def inst():
    return raw_input().strip()
 
def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
mod = 1000000007
def idx(c):
    return ord(c) - ord('a')

class Fenwick(object):
    def __init__(self, n):
        self.n = n
        self.da = [0] * n
    
    def add(self, pos, x):
        while pos < self.n:
            self.da[pos] += x
            pos |= pos + 1

    def ps(self, pos):
        re = 0
        while pos >= 0:
            re += self.da[pos]
            pos &= pos + 1
            pos -= 1
        return re

    def sum(self, x, y):
        return self.ps(y) - self.ps(x-1)

def my_main():
    n, nq = inp()
    da = inp()
    q = []
    for i in range(nq):
        l, r = inp()
        q.append((l, r, i))
    q.sort(key=lambda e:e[-2])
    mp = [-1] * (n+5)
    now = -1
    fw = Fenwick(n)
    ans = [0] * nq
    for l, r, idx in q:
        l -= 1
        r -= 1
        while now < r:
            now += 1
            if mp[da[now]]!=-1:
                fw.add(mp[da[now]], -1)
            mp[da[now]] = now
            fw.add(now, 1)
        ans[idx] = fw.sum(l, r)
        # print mp
    print '\n'.join(map(str, ans))


            

 
 
 
 
my_main()

### FIXED CODE ###

from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
 
# sys.stdin = open('input')
 
def inp(force_list=False):
    re = map(int, raw_input().split())
    if len(re) == 1 and not force_list:
        return re[0]
    return re
 
def inst():
    return raw_input().strip()
 
def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
mod = 1000000007
def idx(c):
    return ord(c) - ord('a')

class Fenwick(object):
    def __init__(self, n):
        self.n = n
        self.da = [0] * n
    
    def add(self, pos, x):
        while pos < self.n:
            self.da[pos] += x
            pos |= pos + 1

    def ps(self, pos):
        re = 0
        while pos >= 0:
            re += self.da[pos]
            pos &= pos + 1
            pos -= 1
        return re

    def sum(self, x, y):
        return self.ps(y) - self.ps(x-1)

def my_main():
    n, nq = inp()
    da = inp()
    q = []
    for i in range(nq):
        l, r = inp()
        q.append((l, r, i))
    q.sort(key=lambda e:e[-2])
    mp = [-1] * (n+5)
    now = -1
    fw = Fenwick(n)
    ans = [0] * nq
    for l, r, idx in q:
        l -= 1
        r -= 1
        while now < r:
            now += 1
            try:
                if mp[da[now]]!=-1:
                    fw.add(mp[da[now]], -1)
                mp[da[now]] = now
            except:
                pass
            fw.add(now, 1)
        ans[idx] = fw.sum(l, r)

    print '\n'.join(map(str, ans))


            

 
 
 
 
my_main()
X = int(input())
if x < 1200:
  print("ABC")
else:
  print("ARC")

### FIXED CODE ###

X = int(input())
if X < 1200:
  print("ABC")
else:
  print("ARC")
a = int(input())

aa = list(map(int,input().split()))

for i in range(1,a):
  aa[i] += a[i-1]
  
su = 10**20

for i in range(a):
  su = min(su,abs(aa[a-1]-2*a[i]))
print(su)

### FIXED CODE ###

a = int(input())

aa = list(map(int,input().split()))

for i in range(1,a):
  aa[i] += aa[i-1]
  
su = 10**20

for i in range(a-1):
  su = min(su,abs(aa[a-1]-2*aa[i]))
print(su)
N = int(input())
arr = list(map(int, input(),split()))

ans = []

for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 1, -1):
		if arr[idx2-1] == idx2:
			ans.append(arr.pop(idx2-1))
			break
		elif idx2 == 1:
			exit(-1)

for idx in range(0, N)
	print(ans.pop(-1))
  	print("\n")


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			tmp = arr.pop(idx2-1)
			ans.append(tmp)
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)
n = int(input())
a = list(range(1, n))
print(sum(a))


### FIXED CODE ###

n = int(input())
ans = (n-1)*(1+n-1)//2
print(ans)
a, b = map(int,input().split())
if a < b:
    buf = a
    a = b
    b = buf
while b != 0:
    a, b = b, a % b
gcd = a
count = 1
if gcd % 2 == 0:
    count += 1
if gcd % 3 == 0:
    count += 1


def hantei(num):
    flag = True
    for i in range(2, int(num**0.5+1)):
        if num % i == 0:
            flag = False
    return flag


for i in range(5, gcd + 1):
    if gcd % i == 0 and hantei(i) == True:
        count += 1
print(count)



### FIXED CODE ###

n = int(input())
if n % 2 == 0:
    print(n//2 / n)
else:
    print((n // 2 + 1) / n)
H, W, K = map(int, input().split())

S = []
for _ in range(H):
    S.append(input())

ans = H * W

for c in range(2**(H-1)):
    num_lines = 0

    g = {}
    tmp = c
    g_index = 0
    for h in range(H):
        g[h] = g_index 
        num_groups = g_index 
        if tmp % 2 == 1:
            g_index += 1
        tmp //= 2

    num_groups += 1

    num_lines = num_groups - 1 

    g_sum = [0] * num_groups

    for w in range(W):
        tmp = g_sum.copy()

        ok = True
        ok2 = True
        for h in range(H):
            tmp[g[h]] += int(S[h][w])
        
            if tmp[g[h]] > K :
                # modoru
                ok = False
                if g_sum[g[h]] == 0:
                    ok2 = False

        if ok :
            g_sum = tmp
        else:
            if ok2:
                g_sum = [tmp[gi] - g_sum[gi] for gi in range(num_groups)]
                num_lines += 1
            else:
                break

    if not ok2:
        continue

    if ans > num_lines:
        ans = num_lines


print(ans)


        

### FIXED CODE ###

H, W, K = map(int, input().split())

S = []
for _ in range(H):
    S.append(input())

ans = H * W

for c in range(2**(H-1)):
    num_lines = 0

    g = {}
    tmp = c
    g_index = 0
    for h in range(H):
        g[h] = g_index 
        num_groups = g_index 
        if tmp % 2 == 1:
            g_index += 1
        tmp //= 2

    num_groups += 1

    num_lines = num_groups - 1 

    g_sum = [0] * num_groups

    for w in range(W):
        tmp = g_sum[:]

        ok = True
        ok2 = True
        for h in range(H):
            tmp[g[h]] += int(S[h][w])
        
            if tmp[g[h]] > K :
                # modoru
                ok = False
                if g_sum[g[h]] == 0:
                    ok2 = False

        if ok :
            g_sum = tmp
        else:
            if ok2:
                g_sum = [tmp[gi] - g_sum[gi] for gi in range(num_groups)]
                num_lines += 1
            else:
                break

    if not ok2:
        continue

    if ans > num_lines:
        ans = num_lines


print(ans)
a, b, c, d = map(int, input().split())

aoki = c
takahashi = a

for i in range(101):
  if takahashi - d > 0: 
    if aoki - b =< 0: #高橋勝ち
      print("Yes")
      break
    else: #戦闘続く
      takahashi = takahashi - d
      aoki = aoki - c
      continue
  else: #高橋負け
    print("No")
    break

### FIXED CODE ###

a, b, c, d = map(int, input().split())

aoki = c
takahashi = a

for i in range(101):
  if aoki - b > 0: #高橋の攻撃
    if takahashi - d <= 0: #青木の攻撃で高橋負け
      print("No")
      break
    else: #戦闘続く
      takahashi = takahashi - d
      aoki = aoki - b
      continue
  else: #高橋勝ち
    print("Yes")
    break
A, B, C = map(int, input().split( ))
if A == B & B==C:
        print('Yes')
    else: 
        print('No')

### FIXED CODE ###

A, B, C = map(int, input().split( ))
if A == B & B==C:
    print('Yes')
else: 
    print('No')
N,T = map(int,input().split(" "))
t = list(map(int,input().split(" ")))
scope = [[t[0],t[0]+T]]

for i in range(1,N):
	if t[i] < scope[-1][1]:
		scope[-1][1] = t[i] + T

	else:
		scope.appned([t[i],t[i]+T])

total = 0
for begin,end in scope:
	total += (end - begin)

print(total)

	


### FIXED CODE ###

N,T = map(int,input().split(" "))
t = list(map(int,input().split(" ")))
scope = [[t[0],t[0]+T]]

for i in range(1,N):
	if t[i] < scope[-1][1]:
		scope[-1][1] = t[i] + T

	else:
		scope.append([t[i],t[i]+T])

total = 0
for begin,end in scope:
	total += (end - begin)

print(total)
# ABC044
N, A = map(int, input().split())
X = list(map(int, input().split()))

# 2 ** 50 -> 全探索は厳しい -> DP
# dp[i][k][wa] = i枚まで見て、k枚選んだ時の合計値がwaとなるときの選び方の合計
# max wa = max(X) * N
max_wa = max(X) * N
dp = [[[0] * (max(X) * (N+1)) for _ in range(N+1)] for __ in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    for k in range(i+1):
        for wa in range(max_wa):
            # 選ぶとき
            dp[i+1][k+1][wa+X[i]] += dp[i][k][wa]
            # 選ばないとき
            dp[i+1][k][wa] += dp[i][k][wa]

ans = 0
for k in range(1, N+1):
    ans += dp[-1][k][k*A]

print(ans)

### FIXED CODE ###

# ABC044
N, A = map(int, input().split())
X = list(map(int, input().split()))

# 2 ** 50 -> 全探索は厳しい -> DP
# dp[i][k][wa] = i枚まで見て、k枚選んだ時の合計値がwaとなるときの選び方の合計
# max wa = max(X) * N
max_wa = max(X) * N
dp = [[[0] * (max(X) * (N+1)) for _ in range(N+1)] for __ in range(N+1)]
dp[0][0][0] = 1
for i in range(N):
    for k in range(i+1):
        for wa in range(max_wa):
            # 選ぶとき
            dp[i+1][k+1][wa+X[i]] += dp[i][k][wa]
            # 選ばないとき
            dp[i+1][k][wa] += dp[i][k][wa]

ans = 0
for k in range(1, N+1):
    if k * A > max_wa:
        break
    ans += dp[-1][k][k*A]

print(ans)
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0

for l in range(k + 1):
	for r in range(k - l + 1):
		hand = []
        if l + r > n:
          break
		#handに左からl個
		hand = v[: l]
        #右からr個の要素を追加
		hand.extend(v[n - r:])
        #現時点でのhandの和をhand_sum
		hand_sum = sum(hand)  
		hand.sort()
        #hand_sum中の負の要素を詰めていく
		for i in range(min(k - l - r, l + r)):
			if hand[i] < 0:
			  hand_sum -= hand[i]
		ans = max(ans, hand_sum)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0

for l in range(k + 1):
	for r in range(k - l + 1):
		hand = []
		if l + r > n:
			break
        #handに左からl個
		hand = v[: l]
        #右からr個の要素を追加
		hand.extend(v[n - r:])
        #現時点でのhandの和をhand_sum
		hand_sum = sum(hand)  
		hand.sort()
        #hand_sum中の負の要素を詰めていく
		for i in range(min(k - l - r, l + r)):
			if hand[i] < 0:
			  hand_sum -= hand[i]
		ans = max(ans, hand_sum)

print(ans)
a=int(input())
lis=list(map(int,input().split()))
lis=sorted(lis)
i=0
while lis[i]<0 and i<a-1:
  if lis[i]<=0 and lis[i+1]>=0:
    if -1*lis[i]>lis[i+1]:
      lis[i],lis[i+1]=-lis[i],-lis[i+1]
  elif lis[i]<=0 and lis[i+1]<=0:
    lis[i],lis[i+1]=-lis[i],-lis[i+1]
  i+=2
print(sum(lis))

### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
c=list(filter(lambda n:n<=0,b))
c=list(map(lambda n:n*-1,c))
d=list(filter(lambda n:n>0,b))
ans=sum(d)+sum(c)
ansl=c+d
if len(c)%2!=0:  
  ans-=min(ansl)*2
print(ans)
x = int(input())

ans = 0
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
        tmp = pow(i, j)
        if tmp > x:
            tmp = pow(i, j-1)
            #print(tmp, i, j)
            break
    ans = max(tmp, ans)

print(ans)

### FIXED CODE ###

x = int(input())

ans = 0
tmp = 1
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
      tmp = pow(i, j)
      if tmp > x:
          tmp = pow(i, j-1)
          #print(tmp, i, j)
          break

    ans = max(tmp, ans)

print(ans)
from collections import deque
N = int(input())
T = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)

x1, x2, x3 = [], [], []
for n in range(1, N + 1):
    if n % 3 == 1:
        x1.append(n)

    elif n % 3 == 2:
        x2.append(n)

    elif n % 3 == 0:
        x3.append(n)


ans = [-1] * N


def allocate(i, pop_target):
    if pop_target == 1:
        if x1:
            ans[i] = x1.pop()
        else:
            ans[i] = x3.pop()

    else:
        if x2:
            ans[i] = x2.pop()
        else:
            ans[i] = x3.pop()


def bfs(s):
    que = deque([(s, 0)])
    pop_target = 1 if len(x1) >= len(x2) else 2

    while que:
        n, depth = que.pop()
        if depth == 2:
            continue

        allocate(n, pop_target)
        for to in T[n]:
            if ans[to] > 0:
                continue
            que.appendleft((to, depth + 1))


for n in range(N):
    if ans[n] > 0:
        continue
    bfs(n)

print(*ans, sep=' ')


### FIXED CODE ###

N = int(input())
T = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)


colors = [-1] * N
stack = [(0, 0)]
while stack:
    n, color = stack.pop()
    colors[n] = color
    for to in T[n]:
        if colors[to] != -1:
            continue
        stack.append((to, color ^ 1))


# あまり１、あまり２、あまり０になるように並び替え
X = [[] for _ in range(3)]
for n in range(1, N + 1):
    X[n % 3].append(n)
X.append(X[0])
del X[0]


ans = []
x12, x3 = X[0] + X[1], X[2]
if colors.count(0) <= N // 3:
    for color in colors:
        if color == 0:
            ans.append(x3.pop())
        elif x12:
            ans.append(x12.pop())
        else:
            ans.append(x3.pop())

elif colors.count(1) <= N // 3:
    for color in colors:
        if color == 1:
            ans.append(x3.pop())
        elif x12:
            ans.append(x12.pop())
        else:
            ans.append(x3.pop())

else:
    for color in colors:
        if X[color]:
            ans.append(X[color].pop())
        else:
            ans.append(X[2].pop())

print(' '.join(map(str, ans)))
import math
n,d=input().split()
n=int(n)
d=int(d)
def combinations(n, r):
    return math.factorial(n)/(math.factorial(n-r)*math.factorial(r))
x=[]
for i in range(n):
    xa=[int(s) for s in input().split()]
    x.append(xa)
    a=[]
for i in range(n-1):
for j in range(i+1,n):
    t=[]
    for k in range(d):
        c=(x[i][k]-x[j][k])*(x[i][k]-x[j][k])
        t.append(c)
    if k==d-1:
        a.append(sum(t))
answer=list(map(lambda x:pow(x,1/2),a))
count=0
for l in range(n):
    if answer[l].is_integer()==True:
        count=count+1
print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N, D = map(int, input().split())
s_lines = sys.stdin.readlines()

ans = 0
X_list_list = []
for s in s_lines:
    new_list = list(map(int, s.split()))
    for i in range(len(X_list_list)):
        sum_num = float(0)
        for idx, ite in enumerate(X_list_list[i]):
            sum_num += (new_list[idx] - ite) ** 2
        if pow(sum_num, 0.5).is_integer():
            ans += 1
    X_list_list.append(new_list)

print(ans)
pc = [list(map(int, input().split())) for i in range(D)]


def dfs(i, sum, count, nokori):
    global ans
    if i == D:
        if sum < G:
            use = max(nokori)
            n = min(pc[use-1][0], -(-(G-sum)//(use*100)))
            count += n
            sum += n * use * 100
        if sum >= G:
            ans = min(ans, count)

    else:
        dfs(i+1, sum, count, nokori)
        dfs(i+1, sum+pc[i][0]*(i+1)*100+pc[i][1], count+pc[i][0], nokori-{i+1})


ans = float('inf')

dfs(0, 0, 0, set(range(1, D+1)))
print(ans)


### FIXED CODE ###

D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]


def dfs(i, sum, count, nokori):
    global ans
    if i == D:
        if sum < G:
            use = max(nokori)
            n = min(pc[use-1][0], -(-(G-sum)//(use*100)))
            count += n
            sum += n * use * 100
        if sum >= G:
            ans = min(ans, count)

    else:
        dfs(i+1, sum, count, nokori)
        dfs(i+1, sum+pc[i][0]*(i+1)*100+pc[i][1], count+pc[i][0], nokori-{i+1})


ans = float('inf')

dfs(0, 0, 0, set(range(1, D+1)))
print(ans)
S1 = int(input())
S2 = int(input())

if S1 > S2:
    print(S1)
elif S1 == S2:
    print(S1 * S2)
else:
    print(S2)

### FIXED CODE ###

A, B, C, D = map(int, input().split())

area = [A * B, C * D]

print(max(area))
import sys

s = input()
t = input()
for i in range(len(s)):
    s = s[-1] + s[:-1]
    print(s)
    if t == s:
        print('Yes')
        sys.exit(1)
print('No')


### FIXED CODE ###

import sys

s = input()
t = input()
n = len(s)
for i in range(n):
    for j in range(n):
        if s[j] == t[(i + j) % n]:
            continue
        else:
            break
    else:
        print('Yes')
        sys.exit(0)
    continue
print('No')
n = input()
l = map(int, raw_input().split())
a = []
for i in range(len(n))
    a.append(l[n - 1])
print ' '.join(map(str, a))

### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.reverse()
for i in a:
    print i,
S = input()
if len(set(s)) == 2:
    for i in list(set(s)):
        if not S.count(i) == 2:
            print('No')
        else:
            print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()
if len(set(S)) == 2 and S.count(list(set(S))[0]) == 2 and S.count(list(set(S))[1]) == 2:
    print ('Yes')
else:
    print('No')
S = input()
L = [i for i in range(97,123)]
n = len(S)
for i in range(n):
    L.remove(ord(S[i]))
if n <= 25:
    X = L[0]
    ans = S + chr(X)
else:
    T = []
    p = 0
    q,r = -1,-1
    for i in range(n):
        j = S[i]
        if ord(j) > p:
            q = i
            T = []
        else:
            if len(T) == 0:
                r = i
                T.append(S[i-1])
            T.append(j)
        p = ord(j)
    if len(T) == 0:
        T.append(S[n-1])
        r = n
    if (r == 1) & (S[r-1] == 'z'):
        ans = -1
    else:
        ans = S[0]
    for i in range(1,r-2):
         ans += S[i]
    for i in range(1,len(T)+1):
            if S[r-2] < T[-i]:
                ans += T[-i]
                break
print(ans)

### FIXED CODE ###

S = input()
L = [i for i in range(97,123)]
n = len(S)
for i in range(n):
    L.remove(ord(S[i]))
if n <= 25:
    X = L[0]
    ans = S + chr(X)
else:
    T = []
    x = S[-1]
    T.append(x)
    for i in range(2,27):
        y = S[-i]
        if y > x:
            x = y
            T.append(y)
        else:
            break
    m = 26 - len(T)
    if m > 1:
        ans = S[0]
        for i in range(1,m-1):
            ans += S[i]
        for t in T:
            if t > S[m-1]:
                ans += t
                break
    elif m == 0:
        ans = -1
    else:
        for t in T:
            if t > S[m-1]:
                ans = t
                break
print(ans)
N,M = map(int,input().split())
H = []
for i in range(M):
  H.append(int(input()))

dp = [0]*N # 初期条件
dp[0] = 1
dp[1] = 0 if 1 in H else 1
for i in range(2,N):
      if i in H:
        dp[i] = 0
      else:
        dp[i] = (dp[i-1]+dp[i-2])%1000000007

print(dp[N-1])

### FIXED CODE ###

mod = 10**9+7
n,m = map(int,input().split())
a = set()
for i in range(m):
  a.add(int(input()))
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1) :
    dp[i] = (dp[i-1] + dp[i-2]) % mod
    if i in a :
        dp[i] = 0
print(dp[n])
n = int(input())
a = [int(i) for i in input().split()]


dic = {}
m = 0
for i in range(len(a)):
    if a[i] in dic.keys():
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1

ls = list(dic.keys())

if len(ls) <= 2 and 0 in ls:
    ls.sort()
    if dic[ls[0]] == 2 * dic[ls[1]]:
        print("Yes")
    else:
        print("No")
elif len(ls) == 3:
    ls.sort()
    if  dic[ls[0]] == dic[ls[1]] and dic[ls[0]] == dic[ls[2]]:
        if list(ls)[0] ^ list(ls)[1] == list(ls)[2]:
            print("Yes")
        else:
            print("No")
else:
    print("No")




### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]

#a_b = []
dic = {}
m = 0
for i in range(len(a)):
    if a[i] in dic.keys():
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1

ls = list(dic.keys())

if len(ls) <= 2 and 0 in ls:
    ls.sort()
    #2種類の時...0と何か
    if len(ls) == 2:
        #0の数が他の数の半分
        if 2 * dic[ls[0]] == dic[ls[1]]:
            print("Yes")
        else:
            print("No")
    #1種類の時...0だけ
    else:
        print("Yes")
#3種類の時...全ての個数が揃っていて2つが1つの排他的論理和になっている
elif len(ls) == 3:
    ls.sort()
    if  dic[ls[0]] == dic[ls[1]] and dic[ls[0]] == dic[ls[2]]:
        if list(ls)[0] ^ list(ls)[1] == list(ls)[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
#4種類以上の時...ダメ
else:
    print("No")

"""
for i in a:
    if i == max(a):
        m = i
    #print(bin(i))
for i in a:
    a_b.append(bin(i)[:2]+'0'*(len(bin(m))-len(bin(i)))+bin(i)[2:])

#for i in range(len(a_b)):
#    print(a_b[i])


a = int("0b" + "0" * (len(bin(m))-2),2)

for i in range(len(a_b)):
    a = a ^ int(a_b[i],2)
if a == 0:
    print("Yes")
else:
    print("No")
"""