N=int(input())
A=list(map(int, input().split()))

divider = 10**9+7

ans = 0
for shift in range(0, 60+1):
    one_num = 0
    for a in A:
        one_num += (a>>shift) & 1
    ans += (2**shift)*one_num*(N-one_num)
print(ans%divider)
