#!/usr/bin/env python3
import sys
n = int(input())
a = list(map(int,input().split()))
ans = 0
mod = (10**9 +7)
for j in range(61):
    num_zero = 0
    for i in range(len(a)):
        if a[i] % 2 == 0: 
            num_zero += 1
        a[i] = a[i] //2
    #print(a)
    ans += num_zero * (n-num_zero) * (2**j) 
    #print(ans)
print(ans%mod)