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

K = int(input())
 
def gcd(x, y):
  if y == 0: return x
  else: return gcd(y, x % y)

s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      s += gcd(gcd(a, b), c)
      
print(s)

### FIXED CODE ###

import math
K = int(input())
 
s = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    d = math.gcd(a, b)
    for c in range(1, K+1):
      s += math.gcd(d, c)
      
print(s)
### BUGGY CODE ###

X,Y,A,B,C=map(int, input().split())
AA=list(map(int, input().split()))
BB=list(map(int, input().split()))
CC=list(map(int, input().split()))
AA=sorted(AA,reverse=True)
BB=sorted(BB,reverse=True)
CC=sorted(CC,reverse=True)
AAA=AA[0:X]
BBB=BB[0:Y]
for i in CC:
    if i>min(AAA)or i>min(BBB):
        if min(AAA)>min(BBB):
            BBB[-1]=i
            BBB=sorted(BBB,reverse=True)
        if min(BBB)>min(AAA):
            AAA[-1]=i
            AAA=sorted(AAA,reverse=True)
    else:
        break
print(sum(AAA)+sum(BBB))


### FIXED CODE ###

X,Y,A,B,C=map(int, input().split())
AA=list(map(int, input().split()))
BB=list(map(int, input().split()))
CC=list(map(int, input().split()))
AA=sorted(AA,reverse=True)
BB=sorted(BB,reverse=True)
CC=sorted(CC,reverse=True)
XX=sorted(AA[0:X]+BB[0:Y]+CC,reverse=True)
XX=XX[0:X+Y]
print(sum(XX))
### BUGGY CODE ###

n=int(input())
a=[]
for i in range(1,n):
  a.append(i%n)
print(sum(a))

### FIXED CODE ###

n=int(input())
n-=1
a=(n*(n+1))//2
print(a)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10000000)
n, q = map(int, input().split())
edge = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

cost = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    cost[p-1] += x

ans = [0] * n
def dfs(cur, c, parent):
    c += cost[cur]
    ans[cur] = c
    for next in edge[cur]:
        if next != parent:
            dfs(next, c, cur)

dfs(0, 0, -1)
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

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

connect = [set() for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)

counter = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    counter[p-1] += x

ans = [0] * n
def dfs(me, parent, cum):
    cum += counter[me]
    ans[me] = cum
    for child in connect[me]:
        if child != parent:
            dfs(child, me, cum)

dfs(0, -1, 0)

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

n,m=map(int, input().split())
a=[int(input())  for i in  range(m)]
x=(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
  dp[i]+=dp[i-1]+dp[i-2]
  
print(dp[-1]%x)

### FIXED CODE ###

n,m=map(int, input().split())
a=set(int(input())  for i in  range(m))
x=(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
  dp[i]+=dp[i-1]+dp[i-2]
  #print(dp)
  
print(dp[-1]%x)
### BUGGY CODE ###

def main():
  import sys
  read = sys.stdin.read
  
  N,M=map(int,input().split())

  if M == 0:
    print(-1)
    exit()

  INF = 10**6
  m = map(lambda x:int(x)-1, read().split())
  *pqc, = zip(m, m, m)

  to1d={v:{} for v in range(N)}
  count=2
  for p,q,c in pqc:
    if not to1d[p].get(c):
      to1d[p][c] = count
      count += 1
    if not to1d[q].get(c):
      to1d[q][c] = count
      count += 1

  G = [{} for _ in range(count)]
  for p,q,c in pqc:
    v1,v2 = to1d[p][c],to1d[q][c]
    G[v1][v2] = G[v2][v1] = 0

  for v in range(N):
    if len(to1d[v])<=1: continue
    tmp = list(to1d[v].keys())
    for i in range(len(tmp)-1):
      for j in range(i+1,len(tmp)):
        v1,v2 = to1d[v][tmp[i]],to1d[v][tmp[j]]
        G[v1][v2] = G[v2][v1] = 1

  def dijkstra(start = 0, goal = 1):
      from heapq import heappop, heappush
      NN = len(G)
      d = [INF]*NN
      d[start] = 0
      que = []
      heappush(que, start)
      while que:
          p = divmod(heappop(que),NN)
          v = p[1]
          if d[v] < p[0]: continue
          for u in G[v].keys():
              if d[u] > d[v] + G[v][u]:
                  d[u] = d[v] + G[v][u]
                  heappush(que, d[u]*NN+u)
          if v == goal: return d[goal]
      return d[goal]

  for c in to1d[0].keys():
    v = to1d[0][c]
    G[0][v] = 1
  for c in to1d[N-1].keys():
    v = to1d[N-1][c]
    G[v][1] = 0

  ans = dijkstra(0,1)
  print(ans if ans < INF else -1)
  
if __name__=="__main__":
  main()

### FIXED CODE ###

def main():
  N,M=map(int,input().split())

  if M == 0:
    print(-1)
    exit()

  INF = 10**6
  pqc = [tuple(map(lambda x:int(x)-1,input().split())) for _ in range(M)]

  to1d={v:{} for v in range(N)}
  count=2
  for p,q,c in pqc:
    if not to1d[p].get(c):
      to1d[p][c] = count
      count += 1
    if not to1d[q].get(c):
      to1d[q][c] = count
      count += 1

  G = [{} for _ in range(N+count)]
  for p,q,c in pqc:
    v1,v2 = to1d[p][c],to1d[q][c]
    G[v1][v2] = G[v2][v1] = 0

  for i in range(N):
    if len(to1d[i])<=1: continue
    for c in to1d[i].keys():
      v = to1d[i][c]
      G[v][count] = 1
      G[count][v] = 0
    count += 1

  def dijkstra(start = 0, goal = 1):
      from heapq import heappop, heappush
      NN = len(G)
      d = [INF]*NN
      d[start] = 0
      que = []
      heappush(que, start)
      while que:
          p = divmod(heappop(que),NN)
          v = p[1]
          if d[v] < p[0]: continue
          for u in G[v].keys():
              if d[u] > d[v] + G[v][u]:
                  d[u] = d[v] + G[v][u]
                  heappush(que, d[u]*NN+u)
          if v == goal: return d[goal]
      return d[goal]

  for c in to1d[0].keys():
    v = to1d[0][c]
    G[0][v] = 1
  for c in to1d[N-1].keys():
    v = to1d[N-1][c]
    G[v][1] = 0

  ans = dijkstra(0,1)
  print(ans if ans < INF else -1)
  
if __name__=="__main__":
  main()
### BUGGY CODE ###

# import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import sys
# import bisect
# import numpy as np
# from scipy.special import comb

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


def main():

    ans = 0
    for i in range(1000):
        d1 = (i // 100) % 10
        d2 = (i // 10) % 10
        d3 = i % 10
        d1_flag = False
        d2_flag = False
        d3_flag = False

        for j in range(N):
            now = int(S[j])
            if not d1_flag:
                if d1 == now:
                    d1_flag = True
            elif not d2_flag:
                if d2 == now:
                    d2_flag = True
            elif not d3_flag:
                if d3 == now:
                    ans += 1
                    #print(d1, d2, d3)
                    break

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

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

ans = 0


for i in range(10):
    for j in range(10):
        for k in range(10):
            flag1 = 0
            flag2 = 0
            
            for l in range(n):
                if flag1 == 0 and s[l] == str(i):
                    flag1 = 1
                    continue
                
                if flag1 == 1 and flag2 == 0 and s[l] == str(j):
                    flag2 = 1
                    continue
                
                if flag1 == 1 and flag2 == 1 and s[l] == str(k):
                    ans += 1
                    break
                
print(ans)
### BUGGY CODE ###

# 解説を読んでからrun-length

S = input()

# build run-length
Srl = []
SS = ''
i = 0
while i < len(S):
    j = i
    while j < len(S) and S[i] == S[j]:
        j += 1
    SS += "{}{}".format(S[i], j - i)
    Srl.append((S[i], j - i))
    i = j

def solve(nR, nL):
    s = "{}{}".format('R' * nR, 'L' * nL)
    # print(nR, nL, s)

    # 10^100は偶数ステップ
    # 協会のRの位置: nR - 1 (ここから偶数ステップ)
    # 協会のLの位置: nR (ここから偶数ステップ)

    idxR = [k for k in range(nR - 1, nR + nL, 2)]
    idxL = [k for k in range(nR, nR + nL, 2)]
    for i in range(nR):
        if i in idxR or i in idxL:
            continue
        if i not in idxR and (i - (nR - 1)) % 2 == 0:
            idxR.append(i)
        elif i not in idxL:
            idxL.append(i)

    numR = len(idxR)
    numL = len(idxL)
    ans = [0] * (nR + nL)
    ans[nR - 1] = numR
    ans[nR] = numL
    return ans

ans_all = []
for i in range(0, len(Srl), 2):
    ans = solve(Srl[i][1], Srl[i + 1][1])
    ans_all += ans

print(*ans_all)

### FIXED CODE ###

# 解説を読んでからrun-length
# TLEだったので見て修正

import bisect

S = input()
RL = []
for i in range(len(S) - 1):
    if S[i] == 'R' and S[i + 1] == 'L':
        RL.append(i)


ans = [0] * len(S)
for i in range(len(S)):
    idx = bisect.bisect_left(RL, i)
    if S[i] == 'L':  # Lだと見つかった場所の←へ行く
        mark = RL[idx - 1]
    else: # Rだと見つかった場所の→へ行く
        mark = RL[idx]

    if (i - mark) % 2 == 0: # Rの位置から偶数離れていればRの方
        ans[mark] += 1
    else: # 奇数離れていればLの位置へ行く
        ans[mark + 1] += 1

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

def yakusu(x):
    tmp=int(pow(x, 1/2))+1
    out=set()
    for i in range(1, tmp):
        if x%i==0:
            out.add(i)
            out.add(x//i)
    if pow(x, 1/2)%1==0:
        out.add(pow(x, 1/2))
    out=list(out)
    out.sort()
    return out

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

pairwise=True
X=set()

for a in A:
  tmp=yakusu(a)
  for i in tmp[1:]:
    if i in X:
      pairwise=False
    else:
      X.add(i)
      
import math
tmp=A[0]+0
for a in A[1:]:
  tmp=math.gcd(tmp, a)
  
if tmp==1:
  setwise=True
else:
  setwise=False
  
if pairwise==True:
  print('pairwise coprime')
elif setwise==True:
  print('setwise coprime')
else:
  print('not coprime')

### FIXED CODE ###

def yakusu(x):
    tmp=int(pow(x, 1/2))+1
    out=set()
    for i in range(1, tmp):
        if x%i==0:
            out.add(i)
            out.add(x//i)
    if pow(x, 1/2)%1==0:
        out.add(pow(x, 1/2))
    out=list(out)
    out.sort()
    return out

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

pairwise=True
X=set()

for a in A:
  tmp=yakusu(a)
  for i in tmp[1:]:
    if i in X:
      pairwise=False
      break
    else:
      X.add(i)
  if pairwise==False:
    break
      
import math
tmp=A[0]+0
for a in A[1:]:
  tmp=math.gcd(tmp, a)
  
if tmp==1:
  setwise=True
else:
  setwise=False
  
if pairwise==True:
  print('pairwise coprime')
elif setwise==True:
  print('setwise coprime')
else:
  print('not coprime')
### BUGGY CODE ###

from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    S=[int(input()) for i in range(N)]
    ls=[]
    for i in range(1, N + 1):
        for j in combinations(S,i):
            val=sum(j)
            if val%10!=0:
                ls.append(val)

    print(max(ls,default=0))


resolve()

### FIXED CODE ###

def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()
### BUGGY CODE ###

S = input()
MOD = 10**9 + 7

M = 13
dp = [0] * M
dp[0] = 1

for s in S:
    newDp = [0] * M
    if s == '?':
        for m in range(M):
            for s in range(10):
                newDp[(m * 10 + s) % M] += dp[m]
    else:
        s = int(s)
        for m in range(M):
            newDp[(m * 10 + s) % M] += dp[m]
    dp = newDp

print(newDp[5] % MOD)

### FIXED CODE ###

S = input()
MOD = 10**9 + 7
lenS = len(S)

dp = [[0 for _ in range(13)] for _ in range(lenS + 1)]  # dp[digit][d] = digit桁までの mod=d の数
dp[0][0] = 1

digitMask = 1

for digit in range(1, lenS + 1) :
    if(S[-digit] == '?') :
        for d in range(13) :
            for k in range(10) :
                dp[digit][d] = (dp[digit][d] + dp[digit - 1][(d - k * digitMask) % 13]) % MOD
    else :
        a = int(S[-digit])
        for d in range(13) :
            dp[digit][d] = (dp[digit][d] + dp[digit - 1][(d - a * digitMask) % 13]) % MOD
    digitMask *= 10
    digitMask %= 13

ans = (dp[len(S)][5]) % MOD
print(ans)
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for i in range(q)]
accnt = 0

for i in range(q):
    for j in range(lr[i][0],lr[i][1]):
        if s[j-1] == "A" and s[j] == "C":
            accnt += 1
    else:
        print(accnt)
        accnt = 0

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for i in range(q)]

aclist = [0,0]
acsum = 0

for i in range(1,n):
    if s[i-1] == "A" and s[i] == "C":
        acsum += 1
    aclist.append(acsum)

for i in range(q):
    if aclist [lr[i][0]] - aclist [lr[i][0]-1] != 0:
        ans = aclist[lr[i][1]] - aclist[lr[i][0]-1] - 1 
    else:
        ans = aclist[lr[i][1]] - aclist[lr[i][0]-1]
    print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

d = 1000000000 + 7

s = 0
for i in range(N):
    s += A[i] * sum(A[i+1:])
print(s % d)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

d = 1000000000 + 7

s = 0

sum_list = [A[0]]
for a in A[1:]:
    sum_list.append(a + sum_list[-1])
for i in range(N):
    s += A[i] * (sum_list[N-1] - sum_list[i])
print(s % d)
### BUGGY CODE ###

h,w  = map(int,input().split())
a = [input() for _ in range(h)]
black = []
white = []
ans = 0

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            black.append([i,j])
        else:
            white.append([i,j])

for i in range(len(white)):
    min1 = 10**10
    for j in range(len(black)):
        min1 = min(min1,abs(black[j][0]-white[i][0])+abs(black[j][1]-white[i][1]))
    ans = max(ans,min1)

print(ans)


### FIXED CODE ###

import copy
#import time

h,w = map(int,input().split())
a = [input() for _ in range(h)]
b = [[False]*w for _ in range(h)]
#s = time.time()
c = []
d = [(-1,0), (1,0), (0,-1), (0,1)]
ans = 0

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            b[i][j] = True
            c.append((i,j))
#print(time.time()-s)

while True:
    tmp = []
    cnt = 0
    for i,j in c:
        for d1,d2 in d:
            if 0 <= i + d1 < h and 0 <= j + d2 < w:
                if not b[i+d1][j+d2]:
                    tmp.append((i+d1, j+d2))
                    b[i+d1][j+d2] = True
                    cnt += 1
    #print(time.time()-s)
    if cnt > 0:
        c = copy.copy(tmp)
        ans += 1
    else:
        break
    #print(time.time()-s)

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


def main():
    """"ここに今までのコード"""
    import sys
    input = sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    A.sort()
    if n==1:
        ans=(m//(A[0]//2)+1)//2
        print(int(ans))
        exit()
    from fractions import gcd
    kou=A[0]*A[1]//gcd(A[0],A[1])
    for a in range(n):
        kou=A[a]*kou//gcd(A[a],kou)
        if (kou//A[a])%2==0:
            print(0)
            exit()
    kou//=2
    #print(kou)
    ans=(m//kou+1)//2
    print(int(ans))
if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    """"ここに今までのコード"""
    import sys
    input = sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    #A.sort()
    if n==1:
        ans=(m//(A[0]//2)+1)//2
        print(int(ans))
        exit()
    from fractions import gcd
    kou=A[0]*A[1]//gcd(A[0],A[1])
    for a in A:
        kou=a*kou//gcd(a,kou)
        if (kou//a)%2==0:
            print(0)
            exit()
    kou//=2
    #print(kou)
    ans=(m//kou+1)//2
    print(int(ans))
if __name__ == '__main__':
    main()
### BUGGY CODE ###

#36
N,M = map(int,input().split())
li = []
ri = []
x = []
y = [i for i in range(1,N+1)]
cou = 0
for i in range(M):
    L,R = map(int,input().split())
    for i in y:
        if L<=i and R>=i:
            x.append(i)
    y = x
    x = []
          
cou = len(y)
print(cou)
        
    

### FIXED CODE ###

#36
N,M = map(int,input().split())
li = []
ri = []
num = 0


for i in range(M):
    L,R = map(int,input().split())
    li.append(L)
    ri.append(R)
L = max(li)
R = min(ri)
num = R-L+1
if num <0:
    num= 0
    
print(num)
### BUGGY CODE ###

def division(n):
    a = [1]
    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 a
def main():
    n = int(input())
    c = division(n)

    ans = 10**12
    for i in range(2**(len(c))):
        x,y = 1,1
        for j in range(len(c)):
            if i>>j&1:
                x *= c[j]
            else:
                y *= c[j]
        ans = min(ans,x+y-2)
    print(ans)
main()

### FIXED CODE ###

n = int(input())
ans = 10**12
for a in range(1,10**6+1):
    if n%a==0:
        b=n//a
    ans = min(ans,a+b-2)
print(ans)
### BUGGY CODE ###

import math


def make_divisors(n):
    s = math.sqrt(n)
    i = int(s+1)
    while i >= 1:
        if n % i == 0:
            yield i
            if i != n // i:
                yield n//i
        i -= 1


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

exist = set()
dup = set()
for item in a:
    if item in exist:
        dup.add(item)
    else:
        exist.add(item)

ret = 0

for val in a:
    is_ok = True
    if val in dup:
        continue
    for item in make_divisors(val):
        if item == val:
            continue
        elif item in cand:
            is_ok = False
            break
    if is_ok:
        ret += 1

print(ret)


### FIXED CODE ###

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

cand = set(a)

exist = set()
dup = set()
for item in a:
    if item in exist:
        dup.add(item)
    else:
        exist.add(item)

dame_set = set()

a.sort()
ret = 0

for val in a:
    if val in dup:
        if val in dame_set:
            continue
        else:
            i = 1
            cnt = 10 ** 6 // val
            while i <= cnt:
                tmp = i * val
                if tmp in cand:
                    dame_set.add(tmp)
                i += 1
    else:
        if val in dame_set:
            continue
        else:
            ret += 1
            i = 1
            cnt = 10 ** 6 // val
            while i <= cnt:
                tmp = i * val
                if tmp in cand:
                    dame_set.add(tmp)
                i += 1

print(ret)
### BUGGY CODE ###

N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
AC = list(set([L[j][0] for j in range(M) if L[j][1] == 'AC']))
P = [L[:L.index([k, 'AC'])].count([k, 'WA']) for k in AC]
print(len(AC), sum(P))

### FIXED CODE ###

N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)
### BUGGY CODE ###

N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]

MOD = 1000000007
from collections import defaultdict
from fractions import Fraction

zero_zero_count = 0
zero_one_count = 0
one_zero_count = 0
dd_ba = defaultdict(int,{})
dd_ab = defaultdict(int,{})
for a,b in AB:
  if (a==0)and(b==0):
    zero_zero_count += 1
  elif (a==0):
    zero_one_count += 1
  elif (b==0):
    one_zero_count += 1
  else:
    dd_ba[Fraction(-b, a)] += 1
    dd_ab[Fraction(a, b)] += 1
  

ans = (2**zero_one_count + 2**one_zero_count -1)
flag_dd = defaultdict(bool,{})
for key,value in dd_ba.items():
  if flag_dd[key]:
    continue
  ans *= (2**dd_ab[key] + 2**value - 1) % MOD
  ans %= MOD
  flag_dd[Fraction(key.denominator, -(key.numerator))] = True
  
ans += zero_zero_count - 1
print(ans%MOD) 

### FIXED CODE ###

def main():
  from math import gcd
  from collections import defaultdict
  import sys
  input = sys.stdin.readline
  N = int(input())
  AB = [list(map(int,input().split())) for _ in range(N)]

  MOD = 10**9 + 7

  zero_zero_count = 0
  zero_one_count = 0
  one_zero_count = 0
  dd_ba = defaultdict(int, {})
  for a,b in AB:
    if (a==0)and(b==0):
      zero_zero_count += 1
    elif (a==0):
      zero_one_count += 1
    elif (b==0):
      one_zero_count += 1
    else:
      if a * b < 0:
        a = abs(a)
        b = abs(b)
        g = gcd(a, b)
        dd_ba[(b//g, a//g)] += 1
      else:
        a = abs(a)
        b = abs(b)
        g = gcd(a, b)
        dd_ba[(-b//g, a//g)] += 1

  ans = (2**zero_one_count + 2**one_zero_count -1)
  dd_flag = defaultdict(bool, {})

  for key,value in tuple(dd_ba.items()):
    if dd_flag[key]:
      continue
    
    key_0 = key[0]
    key_1 = key[1]
    if key_0<0:
      x = (key_1, -key_0)
    else:
      x = (-key_1, key_0)
    y = dd_ba[x]
    ans *= (2**y + 2**value - 1) % MOD
    ans %= MOD
    dd_flag[x] = True

  ans += zero_zero_count - 1
  print(ans%MOD) 

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

n=int(input())
l=list(map(int,input().split()))
sum=0
mod=10**9+7
for i in range(n-1):
  for j in range(i+1,n):
    sum=(sum+(l[i]^l[j]))%mod
print(sum)

### FIXED CODE ###

n=int(input())
l1=[0]*61
l=list(map(int,input().split()))
for j in range(n):
  s=list(str(bin(l[j])))
  for i in range(61):
    if i==len(s)-2:
      break
    if s[-i-1]=='1':
      l1[i]+=1
c=0
for i in range(61):
  c+=pow(2,i,10**9+7)*(n-l1[i])*l1[i]%(10**9+7)
print(c%(10**9+7))
### BUGGY CODE ###

#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
a = LI()

anss = []
for i in range(N):
    ans = 0
    for j in range(N):
        if i != j:
            ans ^= a[j]

    anss.append(ans)

anss = map(str, anss)
print(" ".join(anss))


### FIXED CODE ###

#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
a = LI()

anss = []
ans_base = 0
for i in range(N):
    ans_base ^= a[i]

for i in range(N):
    anss.append(ans_base ^ a[i])


anss = map(str, anss)
print(" ".join(anss))