Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import math
n = int(input())
nlist = list(map(int,input().split()))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

countlist = [0]*(len(nlist) + 1)
for i in range(0,len(nlist) + 1):
    countlist[i] = nlist.count(i)

count = 0
for i in range(0,len(nlist)):
    if countlist[i] >= 2:
        count+=combinations_count(countlist[i],2)

anslist = []

for i in range(0,len(nlist)):
    anslist.append((count-countlist[nlist[i]])+1)

for i in anslist:
    print(i)

### FIXED CODE ###

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

import collections

count_dict=collections.Counter(nlist)

anslist=[]
all_kumi=0
for i in count_dict.values():
    all_kumi += i*(i-1)//2
 
for j in range(0,n):
    print(all_kumi - count_dict[nlist[j]] + 1)
### BUGGY CODE ###

import math

N = int(input())
a = []
s = 0
for _ in range(N):
    a_i = int(input())
    a.append(a_i)
    s += a_i

# Calculate counts of (R >= s / 2)
dp = [[0 for _ in range(s + 1)] for _ in range(N + 1)]
for i in range(N + 1):
    for j in range(s + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        else:
            dp[i][j] = dp[i - 1][j] * 2 + (dp[i - 1][j - a[i - 1]] if j >= a[i - 1] else 0)
c0 = sum(dp[N][math.ceil(s / 2):s+2])

# Calculate counts of (R == s / 2 and G == s / 2)
dp = [[0 for _ in range(s + 1)] for _ in range(N + 1)]
for i in range(N + 1):
    for j in range(s + 1):
        if i == 0:
            dp[i][j] = 1 if j == 0 else 0
        else:
            dp[i][j] = dp[i - 1][j] + (dp[i - 1][j - a[i - 1]] if j >= a[i - 1] else 0)
c1 = dp[N][s // 2] if s % 2 == 0 else 0

ans = (3 ** N - 3 * c0 + 3 * c1) % 998244353
print(ans)

### FIXED CODE ###

import math
import numpy as np

N = int(input())
a = np.array([int(input()) for _ in range(N)])
s = np.sum(a)

# Counts of (R >= s / 2)
dp0 = np.zeros((N + 1, s + 1))
dp0[0, 0] = 1
# Counts of (R == s / 2 and G == s / 2)
dp1 = np.zeros((N + 1, s // 2 + 1))
dp1[0, 0] = 1

mod = 998244353
for i, x in enumerate(a):
    dp0[i + 1, :] += dp0[i, :] * 2 % mod
    dp0[i + 1, x:] += dp0[i, :-x] % mod
    dp1[i + 1, :] += dp1[i, :] % mod
    dp1[i + 1, x:] += dp1[i, :-x] % mod

c0 = int(np.sum(dp0[N][math.ceil(s / 2):]))
c1 = int(dp1[N][s // 2]) if s % 2 == 0 else 0

ans = (3 ** N - 3 * c0 + 3 * c1) % mod
print(ans)
### BUGGY CODE ###

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

## 種類数の求め方
# 1. A内の要素を取り出して、それがA内に存在するとき：種類＋１
# 2. その要素を重複数だけAから削除してループ

kinds = 0
A = sorted(A)
duplicatedList = []
while len(A) > 0:
    if A[0] in A:
        kinds += 1
        duplicatedList.append(A.count(A[0]))
        for j in range(A.count(A[0])):
            A.remove(A[0])

if kinds <= K:
    print('0')
elif kinds > K:
    duplicatedList = sorted(duplicatedList)
    i = 0
    tmp = 0
    while kinds > K:
        kinds -= 1
        tmp += duplicatedList[i]
        i += 1
    print(tmp)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
d={}
l=[]
for i in range(n):
    try:
        l[d[a[i]]]+=1
    except:
        d[a[i]]=len(l)
        l.append(1)
ans=0
l.sort()
for i in range(len(l)-k):
    ans+=l[i]
print(ans)
### BUGGY CODE ###

a=int(input())
li = list(map(int,input().split()))
c = 0

def make_divisors(n):
    yakusuu_array= []
    for i in range(1,n):
        if n % i == 0:
            yakusuu_array.append(i)
    
    return yakusuu_array


for i in range(len(li)-1):
    if len(list(set(li))) != len(li):
        c = 1
        break
    for j in range(i+1,len(li)):
        x = make_divisors(li[i])
        y = make_divisors(li[j])
        z = x + y 
        if len(x)+len(y)-1 == len(z):
            c =1
            break

if c > 0:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

a=int(input())
li = list(map(int,input().split()))
c = 0
if len(li) != len(set(li)):
    print('NO')
else:
    print('YES')
### BUGGY CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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

uf = UnionFind(N)

for i in range(M):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)

all_group_members = uf.all_group_members()
ans = 0

for k, v in all_group_members.items():
    ans = max(ans, len(v))

print(ans)




### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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

uf = UnionFind(N)
# check = set()

for i in range(M):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)
    # check.add(a-1)

# ans = 0
# for i in check:
#     ans = max(ans, uf.size(i))

print(min(uf.parents)*(-1))

# print(ans)
### BUGGY CODE ###

# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    res = []

    total = 0
    for i in range(m):
        d, c = sys.stdin.readline().split()
        s = d
        count = 0
        for _ in range(int(c)-1):
            s = str(int(s) + int(d))
            count += 1
            if len(s) == 2:
                s = str(int(s[0]) + int(s[1]))
                count += 1
        total += count
        res.append(s)
    

    s = res[0]
    for i in range(1, m):
        s = str(int(s) + int(res[i]))
        total += 1
        if len(s) == 2:
            s = str(int(s[0]) + int(s[1]))
            total += 1
    print(total)
    

if __name__ == '__main__':
    main()


### FIXED CODE ###

# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, Q = map(int, input().split())
S=list(input())
list=[0]*N
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        list[i]+=1
count=0
for j in range(Q):
    l, r = map(int, input().split())
    print(list[l-1:r-1].count(1))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

ans = [0]*N
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        ans[i+1] += (ans[i]+1)
    else:
        ans[i+1] = ans[i] 

for i in range(Q):
    l, r = map(int, input().split())
    print(ans[r-1] - ans[l-1])
### BUGGY CODE ###

a = int(input())
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = []
su  = 0
for i in range(a):
	d.append(b[i]-c[i])
	if b[i]-c[i] < 0:
		su += b[i]-c[i]

d.sort()
k = 0
j = 1
for i in range(a):
	if d[i] > 0:
		su += d[i]
		while d[i]:
			if abs(d[-j]) < d[i]:
				d[i] +=  d[-j]
				j += 1
				k += 1
			else:
				d[-j] += d[i]
		k += 1

if su < 0:
	print(-1)
else:
	print(k)



### FIXED CODE ###

a = int(input())
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = []
su  = 0
kk = 0
for i in range(a):
	d.append(b[i]-c[i])
	if b[i]-c[i] < 0:
		su += b[i]-c[i]
		kk += 1

d.sort()
d.reverse()
k = 0

j = 1

for i in range(a):
	if d[i] > 0:
		su += d[i]
		while kk:
			if d[-j] < 0:
				if abs(d[-j]) <= d[i]:
					d[i] +=  d[-j]
					d[-j] = 0
					j += 1
					k += 1
					kk -= 1
					if d[i] == 0 or d[-j] > 0:
						k += 1
						break
					if i == a - j:
						k += 1
						break
				else:
					d[-j] += d[i]
					d[i] = 0
					k += 1
					break
			else:
				break
	if su >= 0:
		break

if su < 0:
	print(-1)
else:
	print(k)
### BUGGY CODE ###

n = int(input())
l = []
for i in range(n):
  a = input()
  if a in l:
    l.remove(a)
  else:
    l.append(a)
print(len(l))

### FIXED CODE ###

n = int(input())
s = set()
for i in range(n):
  a = input()
  if a in s:
    s.remove(a)
  else:
    s.add(a)
print(len(s))
### BUGGY CODE ###

N,K = map(int,input().rstrip().split(" "))
s = list(map(int,input().strip().split(" ")))
c = [-1 for _ in range(N)]
c[0] = 0
for i in range(N):
  for i2 in range(1,K + 1):
    if i + i2 <= N -1:
      if c[i + i2] == -1 or c[i] + abs(s[i] - s[i + i2]) < c[i + i2]:
        c[i + i2] = c[i] + abs(s[i] - s[i + i2])
print(c[N -1])

### FIXED CODE ###

N,K = map(int,input().rstrip().split(" "))
s = list(map(int,input().strip().split(" ")))
c = [-1 for _ in range(N)]
c[0] = 0
for i in range(N):
  for i2 in range(1,K + 1):
    if i + i2 <= N -1:
      if c[i + i2] == -1 or c[i] + abs(s[i] - s[i + i2]) < c[i + i2]:
        c[i + i2] = c[i] + abs(s[i] - s[i + i2])
print(c[N -1])
### BUGGY CODE ###


Q=int(input())
LR=[]
L,R=0,0
for i in range(Q):
    l,r=map(int,input().split())
    L,R=max(L,l),max(R,r)
    LR.append([l,r])
M=R+1
lst=[0 for i in range(M)]

numlst=set([i for i in range(2,M)])
sosuulst=[]
dellist=set()
while numlst:
    a=min(numlst)
    numlst.remove(a)
    if a:
        sosuulst.append(a)
    dellist.clear()
    for i in numlst:
        if i%a==0:
            dellist.add(i)
    for i in dellist:
        numlst.remove(i)
sosuulst=set(sosuulst)

count=0
for i in range(2,M):
    if i in sosuulst and (i+1)//2 in sosuulst:
        count+=1
    lst[i]=count

for l,r in LR:
    print(lst[r]-lst[max(l-2,0)])


### FIXED CODE ###


Q=int(input())
LR=[]
L,R=0,0
for i in range(Q):
    l,r=map(int,input().split())
    L,R=max(L,l),max(R,r)
    LR.append([l,r])
M=R+1
lst=[0 for i in range(M)]
sosuu=set([2])
count=0
for i in range(3,M//2+1,2):
    flag=0
    for m in sosuu:
        if i%m==0:
            flag=1
            break

    if not flag:
        sosuu.add(i)
        if (i+1)//2 in sosuu:
            count+=1
    lst[i]=count

A=M//2
if not (M//2)%2:
    A-=1

while lst[A]:
    A+=2
#print(A,"A",sosuu,count)
for i in range(A,M,2):
    if (i+1)//2 in sosuu:
        flag=0
        for m in sosuu:
            if i%m==0:
                flag=1
                break
        if not flag:
            sosuu.add(i)
            count+=1
    lst[i]=count
#print(lst)
for l,r in LR:
    print(lst[r]-lst[max(l-2,0)])
### BUGGY CODE ###

import math
import numpy as np
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
num_list =  input().split(' ')
num_list2 = [int(n) for n in num_list]
num_list3 = [0]*n
num_list4 = [0]*n
num_list5 = [0]*n
for i in range(len(num_list2)):
    num_list3[num_list2[i]-1] += 1
for i in range(len(num_list2)):
    size = max(0 , num_list3[num_list2[i]-1])
    if size >= 2:
        ans = comb(size,2)
    elif size == 1:
        ans = 0
    else :
        ans = 0 
    num_list4[num_list2[i]-1] = ans

    size = max(0 , num_list3[num_list2[i]-1]-1)
    if size >= 2:
        ans = comb(size,2)
    elif size == 1:
        ans = 0
    else :
        ans = 0 
    num_list5[num_list2[i]-1] = ans
for i in range(n):
    print(num_list5[num_list2[i]-1]-num_list4[num_list2[i]-1]+np.sum(num_list4))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = [0] * n
for i in a:
    cnt[i-1] += 1
total = [0] * n
for i in range(n):
    total[i] = cnt[i] * (cnt[i] - 1) // 2
total_sum = sum(total)
for i in a:
    ans = total_sum
    ans -= total[i-1]
    ans += (cnt[i-1] - 1) * (cnt[i-1] - 2) // 2
    print(ans)
### BUGGY CODE ###

from itertools import permutations
 
N, M, R = map(int, input().split())
r = [a-1 for a in [int(x) for x in input().split()]]
d = [[float("inf")]*N for _ in range(N)]

for i in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c

for a in range(N):
    d[a][a] = 0

res = float("inf")

for k in range(N):
    for i in range(N):
        for j in range(N):
            if d[i][k]+d[k][j] < d[i][j]:
                d[i][j] = d[i][k]+d[k][j]

for p in permutations(r):
    distance = 0
    for i in range(len(p)-1):
        distance += d[p[i]][p[i+1]]
    res = min(distance, res)

print(res)



### FIXED CODE ###

from itertools import permutations
 
N, M, R = map(int, input().split())
r = [a-1 for a in [int(x) for x in input().split()]]
d = [[float("inf")]*N for _ in range(N)]

for i in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c

for a in range(N):
    d[a][a] = 0

res = float("inf")

for k in range(N):
    for i in range(N):
        for j in range(N):
            if d[i][k]+d[k][j] < d[i][j]:
                d[i][j] = d[i][k]+d[k][j]

for p in permutations(r):
    distance = 0
    for i in range(len(p)-1):
        distance += d[p[i]][p[i+1]]
    res = min(distance, res)

print(res)
### BUGGY CODE ###

h,w,d=map(int,input().split())

board=[0 for _ in range(h*w)]

for i in range(h):
    for j,a in enumerate(input().split()):
        board[i*w+j]=int(a)

q=int(input())


distances=[0 for _ in range(h*w)]

for i in range(d,h*w):
    a=h*w-i
    tmp=board.index(a)
    i=tmp//w
    j=tmp%w
    tmp=board.index(a+d)
    x=tmp//w
    y=tmp%w
    distances[a-1]=distances[a+d-1]+abs(i-x)+abs(j-y)

for _ in range(q):
    l,r=map(int,input().split())
    print(distances[l-1]-distances[r-1])

### FIXED CODE ###

h,w,d=map(int,input().split())

pos=[(0,0) for _ in range(h*w)]

for i in range(h):
    for j,a in enumerate(input().split()):
        pos[int(a)-1]=(i,j)

q=int(input())


distances=[0 for _ in range(h*w)]

for i in range(d,h*w):
    a=h*w-i
    i,j=pos[a-1]
    x,y=pos[a+d-1]
    distances[a-1]=distances[a+d-1]+abs(i-x)+abs(j-y)

for _ in range(q):
    l,r=map(int,input().split())
    print(distances[l-1]-distances[r-1])
### BUGGY CODE ###

import math


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

res = 2 ** n - 1

dpa = {}
dpb = {}
factriala = 1
factrialb = n
for i in range(1, max(a, b)+1):
  if i in [a, b]:
    dpb[i] = factrialb
  factriala *= i
  factrialb *= n-i
  if i in [a, b]:
    dpa[i] = factriala

def ncr_count(r):
  return dpb[r] // dpa[r]

res = res - ncr_count(a) - ncr_count(b)

print(res%MOD)

### FIXED CODE ###

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

res = pow(2, n, MOD) - 1

dpa = {}
dpb = {}
factriala = 1
factrialb = n
for i in range(1, max(a, b)+1):
  if i in [a, b]:
    dpb[i] = factrialb
  factriala *= i
  factriala %= MOD
  factrialb *= n-i
  factrialb %= MOD
  if i in [a, b]:
    dpa[i] = factriala

def ncr_count(r):
  return dpb[r] * pow(dpa[r], MOD-2, MOD)

res = res - ncr_count(a) - ncr_count(b)

print(res%MOD)
### BUGGY CODE ###

h,w,d=map(int,input().split())
box=[list(map(int,input().split())) for i in range(h)]
adress={}
for i in range(h):
    for j in range(w):
        adress[box[i][j]]=[i+1,j+1]
q=int(input())
order=[list(map(int,input().split())) for i in range(q)]
for x,y in order:
    ans=0
    try:
        for i in range(x,y-1,d):
            ans +=abs(adress[i+d][0]-adress[i][0])+abs(adress[i+d][1]-adress[i][1])
        print(ans)
    except:print(0)

### FIXED CODE ###

H, W, D = map(int, input().split())
m = [None] * (H * W + 1)
for i in range(H):
    l = map(int, input().split())
    for j, a in enumerate(l):
        m[a] = (i, j)
Q = int(input())
LR = []
for _ in range(Q):
    l, r = map(int, input().split())
    LR.append((l, r))
 
S = [0] * (H * W + 1)
for k in range(D + 1, H * W + 1):
    x, y = m[k]
    i, j = m[k - D]
    S[k] = S[k - D] + abs(x - i) + abs(y - j)
 
for l, r in LR:
    print(S[r] - S[l])
### BUGGY CODE ###

n = int(input())
a = [int(each) for each in input().split()]
q = int(input())
rep = [tuple(int(each) for each in input().split()) for i in range(q)]

s = [str(sum(a))]

for i in range(q):
    a = [rep[i][1] if x==rep[i][0] else x for x in a]
    s.append(str(sum(a)))
print('\n'.join(s[1:]))

### FIXED CODE ###

import collections

n = int(input())
a = [int(each) for each in input().split()]
q = int(input())
rep = [tuple(int(each) for each in input().split()) for i in range(q)]

s = [sum(a)]

c = collections.Counter(a)
for i in range(q):
    diff = (rep[i][1]-rep[i][0])
    num = c.get(rep[i][0])
    if not num:
        num = 0
    # print('i:', i)
    # print(c)
    # print('差分:', diff, '個数:', num)
    s.append(s[-1]+num*diff)

    # 存在しないときにエラーになる
    if c.get(rep[i][0]):
        c[rep[i][1]] += c.pop(rep[i][0])

print('\n'.join([str(each) for each in s[1:]]))
### BUGGY CODE ###

N= int(input())

MP=[list(map(int,input().split())) for i in range(N)]
MP2=[]
for li in MP:
    MP2.append(li.copy())

MP3=[[-1]*N for _ in range(N)]

# ワーシャルフロイド
for k in range(N):
    for i in range(N):
        for j in range(N):
            cand = MP2[i][k] + MP2[k][j]
            if cand <= MP2[i][j]:
                MP2[i][j] = cand
                if (i != k and j != k):
                    MP3[i][j] = k

for i in range(N):
    for j in range(N):
        if MP[i][j] != MP2[i][j]:
            print(-1)
            exit()

checked=set()

res = set()
def dfs(i,j):
    k = MP3[i][j]
    if k == -1:
        k = i
    if (i,j) in checked:
        return
    checked.add((i,j))
    if (i == k or j == k):
        if i < j:
            res.add((i,j))
    else:
        dfs(i,k)
        dfs(k,j)

for i in range(N):
    for j in range(N):
        dfs(i,j)

ressum = 0
for i,j in res:
    ressum += MP[i][j]

# for li in MP3:
#     print(li)
# print(res)
print(ressum)


### FIXED CODE ###

N=int(input())
MP=[list(map(int,input().split())) for i in range(N)]
MP2=[]
for li in MP:
    MP2.append([i for i in li])

MP3=[[-1]*N for _ in range(N)]

# ワーシャルフロイド
for k in range(N):
    for i in range(N):
        for j in range(N):
            cand = MP2[i][k] + MP2[k][j]
            if cand <= MP2[i][j]:
                MP2[i][j] = cand
                if (i != k and j != k):
                    MP3[i][j] = k

for i in range(N):
    for j in range(N):
        if MP[i][j] != MP2[i][j]:
            print(-1)
            exit()

checked=set()

res = set()
def dfs(i,j):
    k = MP3[i][j]
    if k == -1:
        k = i
    if (i,j) in checked:
        return
    checked.add((i,j))
    if (i == k or j == k):
        if i < j:
            res.add((i,j))
    else:
        dfs(i,k)
        dfs(k,j)

for i in range(N):
    for j in range(N):
        dfs(i,j)

ressum = 0
for i,j in res:
    ressum += MP[i][j]

# for li in MP3:
#     print(li)
# print(res)
print(ressum)
### BUGGY CODE ###

import sys
N,K,Q =map(int,input().split())
A = []
for l in sys.stdin:
    A.append(int(l))
for i in range(N):
    cnt = A.count(i+1)
    Point = K - (Q - cnt)
    if Point >= 1 :
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N,K,Q=map(int,input().split())
L=[K]*N
for i in range(Q):
    A=int(input())
    L[A-1] += 1

for i in L:
    if i - Q > 0 :
        print("Yes")
    else :
        print("No")
### BUGGY CODE ###

import random

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

for j in range(100000):
	chk = 0
	for i in range(n-1): 
		if a[i] == a[i-1] ^ a[i+1]:
			chk += 1
	if a[n-1] == a[n-2] ^ a[0]:
		chk += 1
	if chk == n:
		print("Yes")	
		break
	else:
		random.shuffle(a)
if j == 99999:
	print("No")

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
a_uni = list(set(a))
if len(a_uni) == 1:
	if a[0] == 0:
		print("Yes")
	else:
		print("No")
elif n%3 != 0:
	print("No")
elif len(a_uni) == 2:
	if a.count(0) == n/3:
		print("Yes")	
	else:
		print("No")	
elif len(a_uni) == 3:
	if a_uni[0]^a_uni[1]!=a_uni[2]:
		print("No")
	elif a.count(a_uni[0])==n/3 and a.count(a_uni[1])==n/3:
		print("Yes")
	else:
		print("No")
else:
	print("No")
### BUGGY CODE ###

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

cnt = 1
for i in range(1,N):
    for j in range(0,i):
        if A[i] > A[j]:
            break
    else:
        cnt += 1
print(cnt)

### FIXED CODE ###

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

cnt = 0
# for i in range(1,N):
#     for j in range(0,i):
#         if A[i] > A[j]:
#             break
#     else:
#         cnt += 1
min_value = A[0]
for i in range(N):
    if min_value >= A[i]:
        cnt += 1
        min_value = A[i]

print(cnt)
### BUGGY CODE ###

n, m = map(int, input().split(" "))
answer = 1
for p in range(m // n, 0, -1):
    if m % p == 0:
        print(p)
        break

### FIXED CODE ###

n, m = map(int, input().split())
d = [i for i in range(1, int(m**0.5) + 1) if m % i == 0]
d.extend([m // i for i in d])
print(max([i for i in d if m // i >= n]))
### BUGGY CODE ###

from functools import reduce

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))

l = reduce(lcm, A)
ans = 0
for a in A:
  ans += (l//a) % MOD
  ans %= MOD

print(ans)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def power(n, r, mod=10**9+7):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod


MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))

l = A[0]
for a in A:
  t = l%a
  if t != 0:
    l = lcm(l, a)

l %= MOD
ans = 0
for a in A:
  ans += (l * power(a, MOD-2)) % MOD
  ans %= MOD

print(ans)
### BUGGY CODE ###

import numpy as np
n = input().split()
N = int(n[0])
M = int(n[1])


num_list = []
pr_list = []

for i in range(N):
    a = input().split()
    
    num_list.append(int(a[1]))
    pr_list.append(int(a[0]))

x = np.argsort(np.array(pr_list))

tmp = 0
for i in range(100000):
    key = np.array(num_list)[x[i]]
    if M - key > 0:
        tmp += int(pr_list[x[i]])*key
        M -= key
    elif M - key < 0:
        tmp += int(pr_list[x[i]])*M
        break
    else:
        if i == 0:
            tmp = int(pr_list[x[i]])*M
            break
        else:
            break

print(str(tmp))



### FIXED CODE ###

import numpy as np
n = input().split()
N = int(n[0])
M = int(n[1])

num_list = []
pr_list = []
for i in range(N):
    a = input().split()
    num_list.append(int(a[1]))
    pr_list.append(int(a[0]))

x = np.argsort(np.array(pr_list))

tmp = 0
for i in range(100000):
    key = int(num_list[x[i]])
    if M - key > 0:
        tmp += int(pr_list[x[i]])*key
        M -= key
    else:
        if i == 0:
            tmp = int(pr_list[x[i]])*M
            break
        tmp += int(pr_list[x[i]])*M
        break

print(str(tmp))