Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = tuple(map(int,input().split()))
b = 0
num = 1000000007
A_1 = A[:-1]
A_2 = A[1:]
for i in A_1:
    for j in A_2:
        b += i ^ j
    A_2 = A_2[1:]
    #print(A_2)
print(b%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
b = 0
num = 1000000007
N_1 = N.pop(-1)
N_2 = N.pop(0)
for i in N_1:
    for j in N_2:
        b += N_1 ^ N_2
print(b%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = tuple(map(int,input().split()))
b = 0
c = N-1
num = 1000000007
for i in range(c):
    for j in range(i+1,N):
        b += A[i] ^ A[j]
print(b%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = tuple(map(int,input().split()))
b = 0
c = N-1
num = 1000000007
for i in range(c):
    for j in range(i+1,N):
        b += A[i] ^ A[j]
print(b%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int,input().split()))
b = 0
num = 10**9 + 7
for i in range(N-1):
    #print(i)
    for j in range(i+1,N):
        #print(j)
        b += A[i] ^ A[j]
        #b %= num
if b >= num:
    print(b%num)
else:
    print(b)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int,input().split()))
d = []
d_append = d.append
num = 10**9 + 7
for i in range(N-1):
    #print(i)
    for j in range(i+1,N):
        #print(j)
        b = A[i] ^ A[j]
        #b %= num
        d_append(b)
print(sum(d)%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
d = []
num = 10**9 + 7
for i in range(N-1):
    #print(i)
    for j in range(i+1,N):
        #print(j)
        b = A[i] ^ A[j]
        #b %= num
        d.append(b)
print(sum(d)%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
d = []
num = 10**9 + 7
for i in range(N-1):
    #print(i)
    for j in range(i+1,N):
        #print(j)
        b = A[i] ^ A[j]
        #b %= num
        d.append(b)
print(sum(d)%num)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
    A_0 = 0
    A_1 = 0
    for i in range(N):
        if A[i]>>k&1:
            A_1 += 1
        else:
            A_0 += 1
    num = A_1 * A_0
    ans += (num * 2 ** k)
ans %=  mod
print(ans)