# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
mod = 10**9 + 7

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

ans = 0
for i in range(n):
    a[i] = bin(a[i])[2:].zfill(60)

for i in range(60):
    count = 0
    for j in range(n):
        count += 1 if a[j][i] == '1' else 0

    ans += (pow(2, 59-i, mod) * count * (n-count)) % mod

print(ans % mod)