mod = 98826190947
n = int(input())
a = [0] * (n+1)
ans = 0
ch = [[0] * 10 for _ in range((n+1)*60)]
num = [0] * ((n+1)*60)
tot = 1

def Insert(val):
    global tot
    now = 1
    for i in range(62):
        str = (val >> i) & 1
        if ch[now][str] == 0:
            tot += 1
            ch[now][str] = tot
        now = ch[now][str]
        num[now] += 1

def lowbit(val):
    now = 1
    Ans = 0
    for i in range(62):
        str = (val >> i) & 1
        if ch[now][str^1]:
            Ans = (Ans + (num[ch[now][str^1]] % mod) * ((1 << i) % mod)) % mod
        now = ch[now][str]
    return Ans

for i in range(1, n+1):
    a[i] = int(input())
    Insert(a[i])

for i in range(1, n+1):
    ans = (ans + lowbit(a[i])) % mod

print(ans)

原文地址: https://www.cveoy.top/t/topic/qmBT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录