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

from math import sqrt
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

N = int(input())


def solv_quadratic_equation(a, b, c):
    if b**2 - 4*a*c<0:
        return 0.1, 0.1
    D = (b**2 - 4*a*c) ** (1/2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2

for n in range(1,N+1):
    ans=0
    for x in range(1,int(sqrt(n))+1):
        for y in range(1,int(sqrt(n))+1):
            z1,z2=solv_quadratic_equation(1,x+y, x**2+y**2+x*y-n)
            if z1.is_integer() and z1>=1:
                ans+=1
            if z2.is_integer() and z2>=1:
                ans+=1

    print(ans)


### FIXED CODE ###

from math import sqrt
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

N = int(input())

def solv_quadratic_equation(a, b, c):
    D2 = b**2 - 4*a*c
    if D2<0:
        return 0.1, 0.1
    D = sqrt(D2)
    x_1 = (-b + D) / (2 * a)
    x_2 = (-b - D) / (2 * a)

    return x_1, x_2

for n in range(1,N+1):
    ans=0
    if n < 6:
        print(0)
        continue
    for x in range(1,int(sqrt(n-3))+1):
        for y in range(1,int(sqrt(n-3))+1):
            z1,z2=solv_quadratic_equation(1,x+y, x**2+y**2+x*y-n)
            if z1.is_integer() and z1>=1:
                ans+=1
            if z2.is_integer() and z2>=1:
                ans+=1

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

N = int(input())
A = input()
Q = int(input())
for _ in range(Q):
  B,C = input().split()
  A = A.replace(B,C)
  S = [int(a) for a in list(A.split())]
  print(sum(S))


### FIXED CODE ###

from collections import Counter

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

counter = Counter(a)
sum_res = sum(a)  # はじめの合計、名前がsumだとsum関数とかぶってよくないので

# q回操作します。ループ変数は使わないので_とします（Pythonの慣習）
for _ in range(q):
    before, after = map(int, input().split())

    # 合計を変更します
    sum_res -= before * counter[before]
    sum_res += after * counter[before]

    # 個数を変更します
    counter[after] += counter[before]
    counter[before] = 0

    print(sum_res)
### BUGGY CODE ###

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

lis = {}
lis2= [0]*(10**6+1)
flg1 = True

for i in range(n):
  temp =  make_divisors(a[i])
  for j in temp:
    if j == 1:
      continue
    """
    if not  j in lis:
      lis[j]=1
    else:
      flg1 = False
      lis[j]+=1
      if lis[j]==n:
        print("not coprime")
        quit()
    """
    lis2[j]+=1
    if lis2[j]>1:
      flg1 = False
      if lis2[j]==n:
        print("not coprime")
        quit()
    

if flg1:
  print("pairwise coprime")
else:
  print("setwise coprime")



### FIXED CODE ###

from math import gcd
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return set(a)
  
n = int(input())
a = list(map(int, input().split()))
dic = {}
g = a[0]
flg = True
for i in range(n):
  g = gcd(g, a[i])
  if flg:
    tmp = prime_factorize(a[i])
    for j in tmp:
      if j in dic:
        flg = False
      else:
        dic[j]=1
        
if flg:
  print("pairwise coprime")
elif g == 1:
  print("setwise coprime")
else:
  print("not coprime")
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    S = input()
    N_original = N

    ans = 0
    isleft = True

    def f(n):
        kaisu = N_original - n+1
        for i in range(kaisu):
            if S[i:i+n] in S[i+n:]:
                return True
        return False

    left = 0
    right = N
    N = N//4
    while True:
        if f(N):
            if left == N:
                ans = left
                break
            left = N
        else:
            if right == N:
                ans = right
                break
            right = N
        N = (left + right)//2
    print(ans)

main()


### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    l1 = length = 0
    l2 = 1

    while (l2 + length < N):
        if S[l1:l2] in S[l2:]:
            length = l2 - l1
            l2 += 1
        else:
            l1 += 1
            l2 = l1 + length + 1
    print(length)

main()
### BUGGY CODE ###

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

import numpy as np
l = np.array(list(map(int, input().split())))

for _ in range(M):
	max_ind = np.argmax(l)
	l[max_ind] = l[max_ind]//2

print(np.sum(l))

### FIXED CODE ###

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

import numpy as np
l = list(map(int, input().split()))
l = list(map(lambda x: -1 * x, l))

import heapq

heapq.heapify(l)

for _ in range(M):
	max_value = -1 * heapq.heappop(l)
	heapq.heappush(l, (max_value // 2) * (-1))

print(-1 * sum(l))
### BUGGY CODE ###

N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ex_list = a_list.copy()
ex_list.extend(a_list)

ans = float("inf")
for i in range(N):
    cost = 0
    for j in range(N):
        cost += min(ex_list[N-i+j:N+1+j])

    cost += x * i
    ans = min(ans, cost)
print(ans)


### FIXED CODE ###

N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ex_list = a_list.copy()
ex_list.extend(a_list)

ans = float("inf")
cost_list = [float("inf") for _ in range(N)]
for i in range(N):
    cost = 0
    for j in range(N):
        if i == 0:
            cost += ex_list[N + j]
            cost_list[j] = ex_list[N + j]
        else:
            tmp = cost_list[j]
            if tmp > ex_list[N - i + j]:
                cost_list[j] = ex_list[N - i + j]
                cost += ex_list[N - i + j]
            else:
                cost += tmp

    cost += x * i
    ans = min(ans, cost)
print(ans)
### BUGGY CODE ###

from collections import deque

from sys import stdin
readline = stdin.readline

from builtins import max, min, range

INF = 10 ** 6

H, W = map(int, readline().split())
C1, C2 = map(lambda x: int(x) - 1, readline().split())
D1, D2 = map(lambda x: int(x) - 1, readline().split())
S = [readline()[:-1] for _ in range(H)]



t = [[INF]*W for _ in range (H)]


for h in range (H):
    Sh = S[h]
    th = t[h]
    for w in range (W):
        if Sh[w] == '#':
            th[w] = -1


q = deque([(C1,C2)])
a = 0
t[C1][C2] = a

while q:
    warpq = []
    while q:
        h,w = q.popleft()
        warpq.append((h,w))
        if 0 < h and t[h-1][w] > a:
            t[h-1][w] = a
            q.append((h-1,w))
        if H-1 > h and t[h+1][w] > a:
            t[h+1][w] = a
            q.append((h+1,w))
        if 0 < w and t[h][w-1] > a:
            t[h][w-1] = a
            q.append((h,w-1))
        if w < W-1 and t[h][w+1] > a:
            t[h][w+1] = a
            q.append((h,w+1))

    if t[D1][D2]!= INF:
        break

    a+=1

    for h,w in warpq:
        for i in range (max(0,h-2),min(H,h+3)):
            ti = t[i]
            for j in range (max(0,w-2),min(W,w+3)):
                if ti[j] >a:
                    ti[j] = a
                    q.append((i,j))


if t[D1][D2] == INF:
    print(-1)
else:
    print(t[D1][D2])


### FIXED CODE ###

from collections import deque


def main():
    from sys import stdin
    readline = stdin.readline

    from builtins import max, min, range

    INF = 10 ** 6

    H, W = map(int, readline().split())
    Ch, Cw = map(lambda x: int(x) - 1, readline().split())
    Dh, Dw = map(lambda x: int(x) - 1, readline().split())
    S = [readline()[:-1] for _ in range(H)]

    t = [[INF] * W for _ in range(H)]
    for h in range(H):
        th = t[h]
        Sh = S[h]
        for w in range(W):
            if Sh[w] == '#':
                th[w] = -1

    t[Ch][Cw] = 0
    q = deque([(Ch, Cw)])
    a = 0
    while q:
        warpq = []
        while q:
            h, w = q.popleft()
            warpq.append((h, w))
            if h - 1 >= 0 and t[h - 1][w] > a:
                q.append((h - 1, w))
                t[h - 1][w] = a
            if h + 1 < H and t[h + 1][w] > a:
                q.append((h + 1, w))
                t[h + 1][w] = a
            if w - 1 >= 0 and t[h][w - 1] > a:
                q.append((h, w - 1))
                t[h][w - 1] = a
            if w + 1 < W and t[h][w + 1] > a:
                q.append((h, w + 1))
                t[h][w + 1] = a

        if t[Dh][Dw] != INF:
            break

        a += 1
        for h, w in warpq:
            for i in range(max(0, h - 2), min(H, h + 3)):
                ti = t[i]
                for j in range(max(0, w - 2), min(W, w + 3)):
                    if ti[j] > a:
                        ti[j] = a
                        q.append((i, j))

    if t[Dh][Dw] == INF:
        print(-1)
    else:
        print(t[Dh][Dw])


main()
### BUGGY CODE ###

import numpy as np
n, w = map(int, input().split())
shina = np.array(tuple(tuple(map(int, input().split())) for _ in range(n)))

dp = np.array([[0 for i in range(w+1)] for j in range(n+1)])

for i, wv in enumerate(shina):
    wi = wv[0]
    vi = wv[1]
    dpi = dp[i]

    for sum_w in range(w+1):
        if sum_w - wi >= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dpi[sum_w - wi] + vi)

        dp[i+1][sum_w] = max(dp[i+1][sum_w], dpi[sum_w])

print(dp[-1][-1])

### FIXED CODE ###

import numpy as np
n, w = map(int, input().split())
wv_list = [[int(i) for i in input().split()] for i in range(n)]

dp = np.zeros(w+1)
for wv in wv_list:
    w = wv[0]
    v = wv[1]
    dp[w:] = np.maximum(dp[:-w]+v, dp[w:])

print(int(np.max(dp)))
### BUGGY CODE ###

import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

def main():
    s = ns()
    ans = 0
    ssum = [0]
    for si in s:
        ssum += [(ssum[-1] + int(si))%3]
    for i in range(len(s)-3):
        for j in range(i+3,len(s)):
            if ssum[i] == ssum[j+1] and ((j !=len(s)-1 and int(s[i:j+1])%2019==0) or (j ==len(s)-1 and int(s[i:])%2019==0)):
                ans += 1
    print(ans) 
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

def comb(a,b):
    ans = 1
    for i in range(b):
        ans *= a - i
    for j in range(b):
        ans //= (j + 1)
    return ans

def main():
    s = ns()
    mod = 2019
    tmp1  = 1
    tmp2 = 0
    mod2019 = [1] + [0 for i in range(2018)]
    for i in range(len(s)-1, -1, -1):
        tmp2 = (tmp2 + tmp1*int(s[i]))%mod
        tmp1 = (tmp1*10)%mod
        mod2019[tmp2] += 1
    ans = 0
    for i in range(2019):
        ans += comb(mod2019[i],2)
    print(ans) 
    return

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
d=0
for i in range(n):
    if a.count(a[i])>=1.5:
        d=1
        break
if d==0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

n=int(input())
a=set(map(int,input().split()))
b=len(a)
if n==b:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

from fractions import gcd

def main():
    A, B = [int(i) for i in input().split()]

    G = gcd(A, B)
    factor = set()
    i = 2
    while G != 1:
        while True:
            if G % i == 0:
                factor.add(i)
                G = G // i
            else:
                break
        i += 1
    print(len(list(factor))+1)


if __name__ == "__main__":
    main()

### FIXED CODE ###

from fractions import gcd
import copy


def coprime2(a, b):
    return gcd(a, b) == 1


def main():
    A, B = [int(i) for i in input().split()]

    A_l = divisor(A)
    B_l = divisor(B)
    AB_l = set()
    for a in A_l:
        if a in B_l:
            AB_l.add(a)
    AB_l = sorted(list(AB_l))
    tmp = set(AB_l)
    ans = []
    for i, a in enumerate(AB_l):
        if a not in tmp:
            continue
        try:
            tmp.remove(a)
        except:
            pass
        for b in list(tmp):
            if gcd(a, b) != 1:
                try:
                    tmp.remove(b)
                except:
                    pass
        else:
            ans.append(a)

    print(len(ans))


def divisor(n):
    i = 1
    table = set()
    while i * i <= n:
        if n % i == 0:
            table.add(i)
            table.add(n//i)
        i += 1
    return table


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
import math

def func(s):
    return int(s)-1


N=int(input())
e=[list(map(func,input().split()))+[i] for i in range(N-1)]
e.sort()

x=[0 for i in range(N)]
for i in range(N-1):
    x[e[i][0]]+=1
    x[e[i][1]]+=1
print(max(x))

e2=[[0 for j in range(x[i])]for i in range(N)]
ans=[0 for i in range(N-1)]

for i in range(N-1):
    [p,q,r]=e[i]
    for j in range(x[p]):
        if e2[p][j]==0:
            e2[p][j]=1
            if j<x[q]: e2[q][j]=1
            ans[r]=j
            break
        
for i in range(N-1):
    print(ans[i]+1)



### FIXED CODE ###

import sys
import math

def func(s):
    return int(s)-1


N=int(input())
e=[list(map(func,input().split()))+[i] for i in range(N-1)]
e.sort()

x=[0 for i in range(N)]
for i in range(N-1):
    x[e[i][0]]+=1
    x[e[i][1]]+=1
print(max(x))

e2=[[0 for j in range(x[i])]for i in range(N)]
ans=[0 for i in range(N-1)]

y=[0 for i in range(N)]

for i in range(N-1):
    [p,q,r]=e[i]

    e2[p][y[p]]=1
    if y[p]<x[q]: e2[q][y[p]]=1
    ans[r]=y[p]

    for j in range(y[p],x[p]):
        if e2[p][j]==0:
            y[p]=j
            break
    for j in range(y[q],x[q]):
        if e2[q][j]==0:
            y[q]=j
            break

for i in range(N-1):
    print(ans[i]+1)
### BUGGY CODE ###

n,m = map(int,input().split())
H = list(map(int,input().split()))
A,B = [0]*m,[0]*m
for i in range(m): A[i],B[i] = map(int,input().split())

ans = 0
for i in range(n):
    count = 1
    for j in range(m):
        if i != A[j]-1 and i != B[j]-1: continue
        if i == A[j]-1:
            if H[i] <= H[B[j]-1]:
                count = 0
                break
        if i == B[j]-1:
            if H[i] <= H[A[j]-1]:
                count = 0
                break
    ans += count
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
judge = [1]*n
H = list(map(int,input().split()))

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    if H[a] > H[b]:
        judge[b] *= 0
    elif H[a] < H[b]:
        judge[a] *= 0
    else:
        judge[a] *= 0
        judge[b] *= 0
print(sum(judge))
### BUGGY CODE ###

S = list(input())
S = [int(i) for i in S]
c = 0
#print(S)
while True:
    OK = 0
    flag = 0
    break_flag = 0
    for i in range(len(S)-1):
        if S[i] != S[i+1] and S[i] != 9 and S[i+1] != 9:
            S[i] = 9
            S[i+1] = 9
            OK += 1
        else:
            flag += 1
    #print(S)
    if flag == len(S)-1:
        break_flag = 1
    if OK >= 1:
        for i in range(2*OK):
            S.remove(9)
            c += 1
    #print(S)
    #print(flag)
    if break_flag == 1 or len(S) <= 1:
        break
print(c)

### FIXED CODE ###

S = list(input())
S = [int(i) for i in S]
one = 0
zero = 0
for i in range(len(S)):
    if S[i] == 1:
      one += 1
    elif S[i] == 0:
      zero += 1
print(len(S)-abs(one-zero))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from itertools import accumulate

n, k = map(int, input().split())
A = tuple(map(int, input().split()))
for _ in range(k):
  C = [0]*n
  for i, a in enumerate(A):
    C[max(0, i-a)] += 1
    if i+a < n-1:
      C[i+a+1] -= 1
  A = tuple(accumulate(C))
  if min(A) == n:
    break
print(*A)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from itertools import accumulate

n, k = map(int, input().split())
A = tuple(map(int, input().split()))
for _ in range(k):
  C = [0]*n
  for i, a in enumerate(A):
    C[max(0, i-a)] += 1
    if i+a < n-1:
      C[i+a+1] -= 1
  A = tuple(accumulate(C))
  if min(A) == n:
    break
print(*A)
### BUGGY CODE ###

import sys

K = int(input())

seven = 7 % K
mod = 7 % K
for i in range(10**7):
    if seven % K == 0:
        print(i+1)
        sys.exit()
    else:
        seven = seven * (10 % K) + mod

print(-1)

### FIXED CODE ###

import sys

K = int(input())

seven = 7
mod = 7 % K
for i in range(10**6):
    seven = seven % K
    if seven == 0:
        print(i+1)
        sys.exit()
    else:
        seven = seven * (10 % K) + mod

print(-1)
### BUGGY CODE ###

N = int(input())
S = input()

r = S.count('R')
g = S.count('G')
b = S.count('B')
sum_rgb = r*g*b

# rgbの組み合わせの総数から距離が等しいものを引く
for i in range(N-2):
    for j in range(i+1, N-1):
        k = j + (j-i)
        if k > N-1:
            break
        if len(set([S[i], S[j], S[k]])) == 3:
            sum_rgb -= 1
print(sum_rgb)


### FIXED CODE ###

N = int(input())
S = input()

r = S.count('R')
g = S.count('G')
b = S.count('B')
sum_rgb = r*g*b

# rgbの組み合わせの総数から距離が等しいものを引く
for i in range(N-2):
    for j in range(i+1, N-1):
        k = j + (j-i)
        if k > N-1:
            continue
        if len(set([S[i], S[j], S[k]])) == 3:
            sum_rgb -= 1
print(sum_rgb)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**5)

n, q = list(map(int, input().split()))
adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
tree_value = [0]*(n+1)
for i in range(q):
    p, x = map(int, input().split())
    tree_value[p] += x
searched = set()
def dfs(node, count):
    searched.add(node)
    tree_value[node] += count
    for i in adjacent_list[node]:
        if i not in searched:
            dfs(i, tree_value[node])
dfs(1,0)
for i in range(1,n+1):
    print(tree_value[i])


### FIXED CODE ###

import sys
from queue import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

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

adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    adjacent_list[a].append(b)
    adjacent_list[b].append(a)
tree_value = [0]*(n+1)
for i in range(q):
    p, x = map(int, input().split())
    tree_value[p] += x
searched = set()
"""
def dfs(node, count):
    searched.add(node)
    tree_value[node] += count
    for i in adjacent_list[node]:
        if i not in searched:
            dfs(i, tree_value[node])
"""
used = [0 for i in range(n+1)]
que = Queue()
que.put(1)
while que.qsize() != 0:
    m = que.get()
    used[m] = 1
    for i in adjacent_list[m]:
        if not used[i]:
            tree_value[i] += tree_value[m]
            que.put(i)
for i in range(1,n+1):
    print("{} ".format(tree_value[i]), end = "")
### BUGGY CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

N, W = map(int, raw_input().split())
DP = [0] * (W + 1)
for _ in range(N):
    w, v = map(int, raw_input().split())
    for i in range(w, W + 1)[::-1]:
        DP[i] = max(DP[i], DP[i - w] + v)

print DP[W]

### FIXED CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

N, W = map(int, raw_input().split())
DP = [0] * (W + 1)
for _ in range(N):
    w, v = map(int, raw_input().split())
    for i in range(w, W + 1)[::-1]:
        DP[i] = max(DP[i], DP[i - w] + v)

print DP[W]
### BUGGY CODE ###

n = int(input())
s = list(input())
r = []
g = []
b = []
for i in range(n):
    if s[i] == 'R':
        r.append(i)
    elif s[i] == 'G':
        g.append(i)
    else:
        b.append(i)
ans = len(r)*len(g)*len(b)
for i in r:
    for j in g:
        for k in b:
            if float(k) == (i+j)/2 or float(i) == (j+k)/2 or float(j) == (k+i)/2:
                ans -=1
print(ans)

### FIXED CODE ###

n = int(input())
s = list(input())

r = s.count('R')
g = s.count('G')
b = s.count('B')

cnt = 0
for i in range(n):
    for j in range(i+1,n):
        k = j*2-i
        if k >= n:
            break
        elif s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            cnt +=1
print(r*g*b - cnt)
### BUGGY CODE ###

n=int(input())
s=[0]*n
for i in range(n):
  s[i]=sorted(input())
s.sort()
#print(s)
ans=0
for j in range(1,n):
  cnt=1
  while s[j]==s[j-cnt] and j-cnt>=0:
    cnt+=1
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
dict={}
ans=0
for i in range(n):
  s=str(sorted(input()))
  if s in dict:
    dict[s]+=1
    ans+=(dict[s]-1)
  else:
    dict[s]=1
print(ans)
### BUGGY CODE ###

n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]

mod = 10**9+7
dp = [0]*(n+1)
dp[0]=1
if 1 not in a:
    dp[1]=1
for i in range(2,n+1):
    if i in a :
        continue
    else:
        dp[i]= dp[i-1] + dp[i-2]
        dp[i]%= mod


print(dp[n])

### FIXED CODE ###

n,m = map(int, input().split())
a = set([int(input()) for _ in range(m)])

mod = 10**9+7
dp = [0]*(n+1)
dp[0]=1
if 1 not in a:
    dp[1]=1
for i in range(2,n+1):
    if i in a :
        continue
    else:
        dp[i]= dp[i-1] + dp[i-2]
        dp[i]%= mod


print(dp[n])
### BUGGY CODE ###

import numpy as np

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

b = [0]*n
for i in range(n):
  b[i] = list(map(int, bin(a[i])[2:][::-1]))

l = max(map(len, b))
b_pad = list(map(lambda x: x + [0]*(l-len(x)), b))

for j in range(n):
  b_add = (np.sum(b_pad,axis=0) - np.array(b_pad[j])) % 2
  ans = 0
  for k in range(l):
    ans += (2**(k))*b_add[k]
  print(ans,end=" ")

### FIXED CODE ###

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

s = a[0]
for i in range(1,n):
  s ^= a[i]

ans = [0]*n
for j in range(n):
  ans[j] = s ^ a[j]

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

S = str(input())
N = len(S)
l = 0
r = 0

amari = [0] * N
for i in range(1, N+1):
  kazu = S[N-i:N]
  amari_ = int(kazu) % 2019
  amari[i-1] = amari_

from collections import Counter
c = Counter(amari).most_common()

ans = 0
for i in c:
  if i[1] != 0:
    ans += i[1] * (i[1]-1) // 2
  if i[0] == 0:
    ans += i[1]
print(ans)

### FIXED CODE ###

S = str(input())
N = len(S)

ans = 0
amari = [0] * 2019
amari[0] = 1
follow = 0
POW = 1

for i in reversed(S):
  follow += int(i) * POW
  follow %= 2019
  amari[follow] += 1
  POW *= 10
  POW %= 2019
  
print(sum( i * (i-1) // 2 for i in amari ))
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
c = 0
while l.count(0)!=n:
  for i in range(n-1):
    if l[i]==0 and i!=n-2:
      continue
    elif l[i]==0 and i==n-2:
      c += 1
      l[n-1] -=1
    elif l[i]<=l[i+1] and i!=n-2:
      l[i] -= 1
    elif l[i]<=l[i+1] and i==n-2:
      l[i] -= 1
      l[i+1] -=1
      c += 1
    else:
      c += 1
      l[i] -= 1
      break
print(c)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
c = 0
if n==1:
  print(*l)
  exit()
while l.count(0)!=n:
  for i in range(n-1):
    if l[i]==0 and i!=n-2:
      continue
    elif l[i]==0 and i==n-2:
      c += 1
      l[n-1] -=1
    elif l[i]<=l[i+1] and i!=n-2:
      l[i] -= 1
    elif l[i]<=l[i+1] and i==n-2:
      l[i] -= 1
      l[i+1] -=1
      c += 1
    else:
      c += 1
      l[i] -= 1
      break
print(c)
### BUGGY CODE ###

n = int(input())
x = [0]*n
for i in range(n):
    s = input()
    if s in x:
        n -= 1
    else:
        x[i] = s
print(n)

### FIXED CODE ###

n = int(input())
x = {0}
for i in range(n):
    s = str(input())
    if s in x:
        n -= 1
    else:
        x.add(s)
print(n)