import collections
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

MOD = 10**9 + 7

n = ri()
ls = ril()
counter = collections.defaultdict(int)
for a in ls:
    i = 0
    while a > 0:
        if a % 2 == 1:
            counter[i] += 1
        a //= 2
        i += 1
res = 0
for k, v in counter.items():
    res += (n - v) * v * 2**k % MOD
    res %= MOD
print(res)