n = int(input())
A = [int(i) for i in input().split()]

s = [0]*61
for a in A:
    for i in range(61):
        if(a>>i&1)==1:
            s[i+1] += 1
ans = 0
for i in range(61):
    # print("a",2**(i-1)*s.get(i,0)*(n-s.get(i,0)))
    # print("b",s.get(i,0))
    # print("c",(n-s.get(i,0)))
    ans += 2**(i-1)*s[i]*(n-s[i])
ans = ans % (10**9+7)
print(int(ans))
# print(s)
