import numpy as np

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

d_cumsum = np.zeros(60, dtype='i8')
for v in a:
    d_cumsum += np.array(list(map(int, list(format(v, '060b')))))

res = 0
mod = 10**9 + 7
for i, d in enumerate(reversed(d_cumsum)):
    res += (2**i * d * (n-d)) % mod
    res %= mod

print(res)