import sys
input = sys.stdin.readline

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

mod = 10 ** 9 + 7

a_bin = [format(i, 'b') for i in a]

m = len(max(a_bin, key = len))

ans = 0

for i in range(n):
    a_bin[i] = '0' * (m - len(a_bin[i])) + a_bin[i]

for i in range(1, m+1):
    count = [0, 0]
    for j in a_bin:
        count[int(j[-i])] += 1
    ans += count[0] * count[1] * 2 ** (i-1)

print(ans % mod)
