n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7

ans = 0

for bit in range(61):
    now = 0
    for x in a:
        if x&(1<<bit):now += 1

    ans += (2**bit)*(now*(n - now))
    ans %= mod


print(ans)