import numpy as np
from math import ceil,log2
N = int(input())
a = np.array(list(map(int,input().split())),dtype=np.int64)
ans = 0
count = 1
for i in range(ceil(log2(max(a)))):
    b = a%2
    s = np.count_nonzero(b==1)*np.count_nonzero(b==0)*count
    ans +=s
    count *= 2
    a = a//2
    ans %= 10**9+7
print(ans)
