Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys
ans = sys.maxint

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


tmp = 0
for i in range(-1000, 1001): #iは集会を開く場所
    for j in range(n):
        tmp += pow(x[j] - i, 2)
    if ans > tmp:
        ans = tmp
    tmp = 0
print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
x = [int(i) for i in input().split()]

ans = 2147483647
tmp = 0
for i in range(-1000, 1001): #iは集会を開く場所
    for j in range(n):
        tmp += pow(x[j] - i, 2)
    if ans > tmp:
        ans = tmp
    tmp = 0
print(ans)
n = int(input())
for i in range(1, 7) :
    if (2**i) < n :
        ans = 2**i
print(ans)


### FIXED CODE ###

N = int(input())

nList = [i + 1 for i in range(N)]
res = -1
counter = -1
for n in nList :
    count = 0
    buf = n
    while buf % 2 == 0 :
        count += 1
        buf = buf / 2
    if counter < count :
        counter  = count
        res = n
print(res)
xn=input()
x,n=xn.split()
if n=='0':
  print(int(x))
else:
  p=input()
  p={int(i) for i in p.split()}
  s={i for i in range(1,100)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])

### FIXED CODE ###

xn=input()
x,n=xn.split()
if n=='0':
  print(int(x))
else:
  p=input()
  p={int(i) for i in p.split()}
  s={i for i in range(-150,150)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])
from collections import Counter, deque

N = int(input())
A = list(map(int, input().split())) + [N+1]
B = list(map(int, input().split())) + [N+1]
C = [0]
D = [0]

AB_cn = Counter(A+B)
if AB_cn.most_common()[0][1] > N:
    print("No")
else:
    print("Yes")
    for i in range(N+1):
        if len(C) != A[i]:
            C.extend([i]*(A[i]-len(C)))
        if len(D) != B[i]:
            D.extend([i]*(B[i]-len(D)))
    ans = 0
    for i in range(N):
        curr = C[i+1] - D[i]
        ans= max(curr, ans)
    B = B[:-1]
    ans = [B[(i-x)%N] for i in range(N)]
 
    print(*ans)


### FIXED CODE ###

from collections import Counter, deque

N = int(input())
A = list(map(int, input().split())) + [N+1]
B = list(map(int, input().split())) + [N+1]
C = [0]
D = [0]

AB_cn = Counter(A+B)
if AB_cn.most_common()[0][1] > N:
    print("No")
else:
    print("Yes")
    for i in range(N+1):
        if len(C) != A[i]:
            C.extend([i]*(A[i]-len(C)))
        if len(D) != B[i]:
            D.extend([i]*(B[i]-len(D)))
    ans = 0
    for i in range(N):
        curr = C[i+1] - D[i]
        ans= max(curr, ans)
    B = B[:-1]
    ans = [B[(i-ans)%N] for i in range(N)]
 
    print(*ans)
N = int(input())
if N == 1:
    print('Hello World')
else if N == 2:
    a = int(input())
    b = int(input())
    print(a + b)

### FIXED CODE ###

N = int(input())
if N == 1:
    print('Hello World')
else :
    a = int(input())
    b = int(input())
    print(a + b)
def lcs(x, y, pre_lcs, pre_lcs_len):
    rec = []
    idx = []
    for c in y:
        s = 0
        for i, k in enumerate(idx):
            t = x.find(c, s) + 1
            if t < 1:
                break
            if t < k:
                idx[i] = t
            s = k
        else:
            t = x.find(c, s) + 1
            if t:
                idx.append(t)
        rec.append(idx.copy())
    
    lcs_len = len(idx)
    if lcs_len > pre_lcs_len:
        lcs = ''
        pos = len(idx) - 1
        for line, yc in zip(rec[::-1], y[::-1]):
            i = line[pos] - 1
            xc = x[i]
            if xc == yc:
                lcs += xc
                if pos == 0:
                    return (lcs[::-1], lcs_len)
                pos -= 1
    else:
        return (pre_lcs, pre_lcs_len)

def solve():
    import sys
    file_input = sys.stdin
    for s in file_input:
        s = s.rstrip()
        if s[0] == '#':
            break
        s_len = len(s)
        sep = s_len // 2
        ans, ans_len = lcs(s[:sep], s[sep:], '', 0)
        while sep > ans_len:
            ans, ans_len = lcs(s[:-sep], s[-sep:], ans, ans_len)
            sep -= 1
            ans, ans_len = lcs(s[:sep], s[sep:], ans, ans_len)
        print(ans)

solve()


### FIXED CODE ###

def lcs(x, y, pre_lcs, pre_lcs_len):
    pm = dict((zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', [0] * 26)))
    for c in pm:
        for i, xc in enumerate(x):
            if c == xc:
                pm[c] |= (1 << i)
    
    V = (1 << len(x)) - 1
    rec = []
    
    for yc in y:
        V = ((V + (V & pm[yc])) | (V & ~pm[yc]))
        rec.append(bin(V)[-len(x):])
    
    lcs_len = bin(V)[-len(x):].count('0')
    
    if lcs_len > pre_lcs_len:
        rx = x[::-1]
        lcs = ''
        idx = 0
        for v, yc in zip(rec[::-1], reversed(y)):
            idx = v.find('0', idx)
            if yc == rx[idx]:
                lcs += yc
                if len(lcs) == lcs_len:
                    return (lcs[::-1], lcs_len)
                idx += 1
    else:
        return (pre_lcs, pre_lcs_len)

from sys import stdin

def solve():
    file_input = stdin
    ans_out = []
    for s in file_input:
        s = s.rstrip()
        if s[0] == '#':
            break
        s_len = len(s)
        sep = s_len // 2
        ans, ans_len = lcs(s[:sep], s[sep:], '', 0)
        while sep > ans_len:
            ans, ans_len = lcs(s[:-sep], s[-sep:], ans, ans_len)
            sep -= 1
            ans, ans_len = lcs(s[:sep], s[sep:], ans, ans_len)
        ans_out.append(ans)
    print(*ans_out, sep='\n')

solve()
a,b,q=map(int,input().split())
ls=[]
for i in range(a):
  ls.append(int(input()))
lt=[]
for i in range(b):
  lt.append(int(input()))
def nibutan2(n,l):
  left=0
  right=len(l)-1
  mid=(right+left)//2
  while right>left:
    if l[mid]==n:
      return [0,mid]
    elif l[mid]>n:
      right=mid-1
      mid=(right+left)//2
    else:
      left=mid+1
      mid=(right+left)//2
  if min(abs(l[mid]-n),abs(l[mid-1]-n),abs(l[mid+1]-n))==abs(l[mid]-n):
    return [abs(l[mid]-n),mid]
  elif min(abs(l[mid]-n),abs(l[mid-1]-n),abs(l[mid+1]-n))==abs(l[mid-1]-n):
    return [abs(l[mid-1]-n),mid-1]
  else: 
    return [abs(l[mid+1]-n),mid+1]
for i in range(q):
  n=int(input())
  llt=0
  lls=0
  lltl=nibutann(n,lt)
  llt1=lltl[0]
  llts=lltl[1]
  llt2=nibutann(llts,ls)[0]
  llt=llt1+llt2
  lltl=nibutann(n,ls)
  llt1=lltl[0]
  llts=lltl[1]
  llt2=nibutann(llts,lt)[0]
  lls=llt1+llt2
  print(min(llt,lls))  

### FIXED CODE ###

import bisect
a,b,q=map(int,input().split())
ls=[-10**11]
lg=[-10**11]
for i in range(a):
  ls.append(int(input()))
for i in range(b):
  lg.append(int(input()))
ls.append(10**11)
lg.append(10**11)
ls=sorted(ls)
lg=sorted(lg)
for i in range(q):
  x=int(input())
  i1=bisect.bisect_left(ls,x)
  i2=bisect.bisect_left(lg,x)#xはi-1~iにある
  d1=x-ls[i1-1]
  d2=ls[i1]-x
  d3=x-lg[i2-1]
  d4=lg[i2]-x
  d5=abs(ls[i1-1]-lg[i2-1])
  d6=abs(ls[i1]-lg[i2-1])
  d7=abs(ls[i1-1]-lg[i2])
  d8=abs(ls[i1]-lg[i2])
  ans1=d1+d5
  ans2=d1+d7
  ans3=d2+d6
  ans4=d2+d8
  ans5=d3+d5
  ans6=d3+d6
  ans7=d4+d7
  ans8=d4+d8
  print(min(ans1,ans2,ans3,ans4,ans5,ans6,ans7,ans8))
import math

a = int(input())
print(a*math.pi2*)

### FIXED CODE ###

import math

a = int(input())
print(a*math.pi*2)
N=int(input())
A=list(map(int,input().split()))
dp=[0]*(N)
dp[0]=0
dp[1]=0
dp[2]=abs(A[1]-A[0])
for i in range(3,N):
    dp[i]=min(dp[i-1]+abs(A[i-1]-A[i-2]),dp[i-2]+abs(A[i-1]-A[i-3]))

print(dp[N-1])

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
dp=[0]*(N)
dp[0]=0
dp[1]=abs(A[1]-A[0])
for i in range(2,N):
    dp[i]=min(dp[i-1]+abs(A[i]-A[i-1]),dp[i-2]+abs(A[i]-A[i-2]))
# print(dp)
print(dp[N-1])
def freq(my_list):
    count = {} 
    for i in my_list: 
        count[i] = count.get(i, 0) + 1
    return count

n = int(input())
l = list(map(int, input().split()))
s,f = sum(l), freq(l)
for _ in range(int(input())):
    x, y = map(int, input().split())
    if x in f:
        v = f[x]
        if y in f:
            f[y]+=v
            f.pop(x)
        else:
            f[y]=f.pop(x)
        s += (y-x)*v
    print(s)

### FIXED CODE ###

i= input()
print('A' if (ord(i)>64 and ord(i)<91) else 'a')
s = input()
if s == 'SUN':
  print(7)
elif s == 'SAT':
  print(1)
elif s == 'MON':
  print(6)
elif s == 'TUE':
  print(5)
elif s==  'WED':
  print(4)
elif s == 'THU':
  print(3)
elif s == 'FRI':
  print(2)= input()
 

### FIXED CODE ###

s = input()
if s == 'SUN':
  print(7)
elif s == 'SAT':
  print(1)
elif s == 'MON':
  print(6)
elif s == 'TUE':
  print(5)
elif s==  'WED':
  print(4)
elif s == 'THU':
  print(3)
else:
  print(2)
import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in input().split()]
print(min(A * T, B))

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in input().split()]
print(min(A * N, B))
n, m = map(int, input().split())
print(n(n-1)/2 + m(m-1)/2)

### FIXED CODE ###

n, m = map(int, input().split())
ans = n*(n - 1)/2 + m*(m - 1)/2
print(int(ans))
S = input()
if S[3] == S[4] and S[5] == S[6]:
  print('Yes')
else:
  print('No')
  


### FIXED CODE ###

S = input()
if S[2] == S[3] and S[4] == S[5]:
  print('Yes')
else:
  print('No')
N , K= map(int, input().split())
d = int(input())
A = list(map(int,input().split()))
dk = [int(input()) for ia in range(K)]
Ak = list(map(int, input().split()))

print(N - d)


### FIXED CODE ###

import collections
N , K= map(int, input().split())
c = 0
A =[]
for ia in range(K):
    d = int(input())
    A.extend(list(map(int, input().split())))

sa = collections.Counter(A)
sss = len(sa)
print(N-sss)
N,M,X,Y=map(int,input().split())
x,y=map=(int,input().split())

if (min(y,Y)-max(x,X))>0:
    print('No War')
    
else :
    print('War')

### FIXED CODE ###

N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

x.append(X)
y.append(Y)

if (min(y)-max(x))>0:
    print('No War')
    
else :
    print('War')
N,M = (int(x) for x in input().split())

p_y_list = []
y_count = [1]*(M+1)
for i in range(M):
    p_y_list.append([int(x) for x in input().split()])
    p_y_list[i].append(i)
p_y_list.sort(key = lambda x:x[1])
p_y_id_list = []
for i in p_y_list:
    p_y_id_list.append([i[0],y_count[i[0]],i[2]])
    y_count[i[0]] += 1
p_y_id_list.sort(key = lambda x:x[2])
for i in p_y_id_list:
    print(str(i[0]).rjust(6,"0") + str(i[1]).rjust(6,"0"))

### FIXED CODE ###

N,M = (int(x) for x in input().split())

p_y_list = [0]*M
y_count = [1]*(N+1)

for i in range(M):
    p,y = (int(x) for x in input().split())
    p_y_list[i] = [p,y,i]
p_y_list.sort(key = lambda x:x[1])

for i in p_y_list:
    i[1] = y_count[i[0]]
    y_count[i[0]] += 1

p_y_list.sort(key = lambda x:x[2])
for i in p_y_list:
    print(str(i[0]).rjust(6,"0") + str(i[1]).rjust(6,"0"))
try:
    s1=(input(''))
    if len(s1)>=4:
        raise ValueError
    
    check=list((s1))
    assert bool(int(check[0]+check[1])<=12) != bool(int(check[2]+check[3])<=12)
    if int(check[0]+check[1])<=12:
        print("MMYY")
    elif int(check[2]+check[3])<=12:
        print("YYMM")
except AssertionError:
    if int(check[0]+check[1])<=12 and int(check[2]+check[3])<=12:
        print("AMBIGUOUS")
    else:
        print("NA")



### FIXED CODE ###

a=input()
 
b = int(a[:2])
c = int(a[2:])
 
if 0< b < 13:
    a_month_flag = 1
    
elif b == 0:
    a_month_flag = 0    
else:
    a_month_flag = 0
 
if 0< c < 13:
    b_month_flag = 1
    
elif c == 0:
    b_month_flag = 0
  
else:
    b_month_flag = 0
 
if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA")
#coding: UTF-8

x = input().split()

y = map(int,x)

a = y[0]
b = y[1]

c = a*b
d = (a+b)*2

print(c,d)


### FIXED CODE ###

a,b = [int(x) for x in input().split()]

s = a*b

p = 2*a+2*b

print(s,p)
n,x=map(int,input().split())
pos=list(map(int,input().split()))
pos2=[abs(p-x) for p in pos]
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)
 
        return divisor_list

if n==1: ans=pos2[0]
else:
    minpos= min(pos2)
    divs=make_divisor_list(minpos)[::-1]
    if divs[0]==1:ans=1
    else:
        for j in divs:
        if all(x%j==0 for x in pos2):
            ans=j
            break
print(ans)

### FIXED CODE ###

n,x=map(int,input().split())
pos=list(map(int,input().split()))
pos2=[abs(p-x) for p in pos]
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)
 
        return divisor_list

if n==1: ans=pos2[0]
else:
    minpos= min(pos2)
    divs=make_divisor_list(minpos)[::-1]
    if divs[0]==1:ans=1
    else:
        for j in divs:
            if all(x%j==0 for x in pos2):
                ans=j
                break
print(ans)
s = input()
a = False
b = False
c = False
cnt = 0
k = 0

if s[0] == 'A':
	a = True

for c in range(s[2],s[-1]):
	if c == 'C':
		cnt += 1
if cnt == 1:
	b = True

for c in s:
	if c != 'A' or c != 'C':
		if c.islower() == True:
			k += 1

if k == s.length():
	c = True


if a == b == c == True:
	print("AC")
else:
	print("WC")

### FIXED CODE ###

s = input()
text = s[2:-1]
r = s.replace('A', '')
r = r.replace('C', '')

if s[0] != 'A' or text.count('C') != 1 or r != r.lower():
    print('WA')
else:
	print('AC')
from bisect import bisect_left,bisect

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

a.sort()
ai=max(a)


if ai%2==0:
    ai2=ai//2-1
else:
    ai2=ai//2

jj=bisect(a,ai2)

if jj+1<n:
    if abs(a[jj]-ai2)>abs(a[jj+1]-ai2):
        jj2=jj+1
if jj-1>=0:
    if abs(a[jj]-ai2)>abs(a[jj-1]-ai2):
        jj2=jj-1
    
if jj2==n-1:
    jj2=jj2-1
    
aj=a[jj2]

print(ai,aj)



### FIXED CODE ###


from bisect import bisect_left,bisect

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

a.sort()
ai=max(a)


#if ai%2==0:
#    ai2=ai//2+1
#else:
#    ai2=ai//2
ai2=ai/2

jj=bisect(a,ai2)

if jj+1<n:
    if abs(a[jj]-ai2)>abs(a[jj+1]-ai2):
        jj=jj+1
if jj-1>=0:
    if abs(a[jj]-ai2)>abs(a[jj-1]-ai2):
        jj=jj-1
    
if jj==n-1:
    jj=jj-1
    
aj=a[jj]

print(ai,aj)
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]-sum(a[1::2])))

### FIXED CODE ###

N = int(input())
cards = sorted(list(map(int, input().split())), reverse=True)

alice = 0
bob = 0
for i in range(N):
  if i % 2 == 0:
    alice += cards[i]
  else:
    bob += cards[i]

print(alice-bob)
N, K = map(int, input().split())
pint("Possible" if N*K*(N+K)%3==0 else "Impossible")

### FIXED CODE ###

N, K = map(int, input().split())
print("Possible" if N*K*(N+K)%3==0 else "Impossible")
a, b, c = map(int, input().split())
 
if a == b + c:
  print("Yes")
elif b == a + c:
  print("Yes")
elif c = b + a:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a, b, c = map(int, input().split())
 
if a == b + c:
  print("Yes")
elif b == a + c:
  print("Yes")
elif c == b + a:
  print("Yes")
else:
  print("No")
# coding: utf-8
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = sorted(a)
b1 = sorted(b)
z = [list(map(int, input().split())) for _ in range(M)]

num1 = a1[0] + b1[0]
# print("num1:", num1)        
num1 = min(num1)
# print("num1:", num1)
for i in range(M):
    x, y, c = z[i]
    num = a[x - 1] + b[y - 1] - c
    if num < num1:
        num1 = num
print(num1)

### FIXED CODE ###

# coding: utf-8
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = sorted(a)
b1 = sorted(b)
z = [list(map(int, input().split())) for _ in range(M)]

num1 = a1[0] + b1[0]
# print("num1:", num1)
for i in range(M):
    x, y, c = z[i]
    num = a[x - 1] + b[y - 1] - c
    if num < num1:
        num1 = num
print(num1)
n = int(input())
if n[1] == n[2]:
    if n[0] == n[1] or n[2] == n[3]:
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

n = input()
if n[1] == n[2]:
    if n[0] == n[1] or n[2] == n[3]:
        print("Yes")
        exit()
print("No")
S = input()

if S == ABC :
  print("ARC")
else :
  print("ABC")

### FIXED CODE ###

S = input()

if S == "ABC" :
  print("ARC")
else :
  print("ABC")
N, Y = map(int, input().split())

for x in range(N+1):
    for y in range(N-x+1):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y:
            print(x, y, z)
            exit() # 処理を終わらせる
print(-1, -1, -1)

### FIXED CODE ###

N, Y = map(int, input().split())

for x in range(N+1):
    for y in range(N-x+1):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y:
            print(x, y, N-x-y)
            exit() # 処理を終わらせる
print(-1, -1, -1)
x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)
for r in rc:
    if bi >= b or pa[ai] < qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
    elif ai >= a or pa[ai] > qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)



### FIXED CODE ###



x, y, a, b, c = list(map(int, input().split(' ')))
pa = list(map(int, input().split(' ')))
qb = list(map(int, input().split(' ')))
rc = list(map(int, input().split(' ')))

pa = sorted(pa)[len(pa) - x:]
qb = sorted(qb)[len(qb) - y:]
rc = sorted(rc, reverse=True)

ai = 0
bi = 0
result = sum(pa) + sum(qb)

for r in rc:
    if bi >= len(qb) and ai >= len(pa):
        break
    
    elif bi >= len(qb) or pa[ai] <= qb[bi]:
        if r > pa[ai]:
            result = result - pa[ai] + r
            ai += 1
            
    elif ai >= len(pa) or pa[ai] >= qb[bi]:
        if r > qb[bi]:
            result = result - qb[bi] + r
            bi += 1
print(result)
str = input()
print(f"{str[0]}{len(str) - 2}{str[-1]}")

### FIXED CODE ###

s = input()
print(s[0] + str(len(s) - 2) + s[-1])
#!/usr/bin/env python3

def solve(x):
    memo = [True] + [False]*x
    def dp(k):
        if k < 0:
            return False
        elif memo[k]:
            return True
        for i in range(100,106):
            if dp(k-i):
                memo[k-i] = True
                return True
        
        return False

    return dp(x)



def main():
    X = int(input())
    print(int(solve(X)))
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

def solve(x):
    if x >= 2000:
        return True
    memo = [True] + [False]*x

    def dp(k):
        if k == 0:
            return True
        for i in range(100,106):
            if k-i >= 0 and memo[k-i]:
                return True
        
        return False
    
    for i in range(x):
        memo[i+1] = dp(i+1)
    return memo[x]



def main():
    X = int(input())
    print(int(solve(X)))
    return

if __name__ == '__main__':
    main()
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = max(A)
# 二分探索
while r - l > 1:
    cnt = 0
    flag = False
    m = (r+l)//2
    for a in A:
        # a/mが偶数の場合
        if a % m == 0:
            cnt += a//(m-1)
        # a/mが奇数の場合
        else:
            cnt += a//m
    flag = True if K >= cnt else False
    # Trueなら右側を狭める
    # Falseなら左側を狭める
    if flag == True:
        r = m
    else:
        l = m
print(r)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))


def f(n):
    cnt = 0
    for a in A:
            # a/nが偶数の場合
        if a % n == 0:
            cnt += a//n-1
        # a/nが奇数の場合
        else:
            cnt += a//n
    return True if K >= cnt else False


l = 0
r = max(A)
# 二分探索
while r - l > 1:
    m = (r+l)//2
    if f(m):
        r = m
    else:
        l = m
print(r)
A,B=map(int,input().split())
for i in range(10000):
  if A==int(i*0.08) and B==int(i*0.1) :
    print(i)
    exit()
plint("-1")


### FIXED CODE ###

A,B=map(int,input().split())
for i in range(10000):
  if A==int(i*0.08) and B==int(i*0.1) :
    print(i)
    exit()
print("-1")
A, B, C = input().split()


if A[-1] == B[0] && B[-1] == C[0]:
    print('YES')
else:
    print('NO')










### FIXED CODE ###

A, B, C = input().split()


if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')
import sys
N, M = map(int, input().split())
if M & 1:
    print(-1)
    sys.exit()
Edge = [[] for _ in range(N)]
Dim = [0]*N
for _ in range(M):
    a, b = map(int, sys.stdin.readline().split())
    a -= 1
    b -= 1
    Edge[a].append(b)
    Edge[b].append(a)
    Dim[a] += 1
    Dim[b] += 1
Edge1 = Edge[:]
Dim1 = Dim[:] 
Ans = []
used = set()
for i in sorted(range(N), key = lambda x: Dim[x]):
    Edge[i].sort(key = lambda x: Dim[x], reverse = True)
    while Dim[i] > 1:
        while (i, Edge[i][-1]) in used:
            Edge[i].pop()
        j1 = Edge[i].pop()
        while (i, Edge[i][-1]) in used:
            Edge[i].pop()
        j2 = Edge[i].pop()
        Ans.append((i+1, j1+1))
        Ans.append((i+1, j2+1))
        Dim[i] -= 2
        Dim[j1] -= 1
        Dim[j2] -= 1
        used.add((i, j1))
        used.add((i, j2))
        used.add((j1, i))
        used.add((j2, i))
if not len(Ans) == M:
    Edge = Edge1[:]
    Dim = Dim1[:]
    Ans = []
    used = set()
    for i in sorted(range(N), key = lambda x: Dim[x]):
        Edge[i].sort(key = lambda x: Dim[x], reverse = True)
    while Dim[i] > 1:
        while (i, Edge[i][-1]) in used:
            Edge[i].pop()
        j1 = Edge[i].pop()
        while (i, Edge[i][-1]) in used:
            Edge[i].pop()
        j2 = Edge[i].pop()
        Ans.append((i+1, j1+1))
        Ans.append((i+1, j2+1))
        Dim[i] -= 2
        Dim[j1] -= 1
        Dim[j2] -= 1
        used.add((i, j1))
        used.add((i, j2))
        used.add((j1, i))
        used.add((j2, i))

for a in Ans:
    print(*a)       

### FIXED CODE ###

from collections import Counter
N = int(input())

A = list(map(int, input().split()))
if all(a == 0 for a in A):
        print('Yes')
elif N % 3:
    print('No')
else:
    n = N//3
    CA = Counter(A)
    ans = 'Yes'
    t = []
    for k, v in CA.items():
        if not v % n:
            t.append(k)
        
    if len(t) == 3 and (t[0]^t[1] == t[2] and t[2]^t[1] == t[0] and t[0]^t[2] == t[1]):
        ans = 'Yes'
    elif len(t) == 2 and (t[0] == 0 or t[1] == 0):
        ans = 'Yes'
    else:
        ans = 'No'
        
    print(ans)