n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
keta = 0
while a != [0]*n:
    b = list(map(lambda x: x % 2, a))
    a = list(map(lambda x: x//2, a))
    ans += b.count(0) * b.count(1) * 2**keta
    ans %= mod
    keta += 1
print(ans)
