MOD = 10**9+7
n = int(input())
s = 0
a = list(map(int, input().split()))
m = 64
def calc_sum(arr,  n, m): 
    s = 0
    for i in range(0, m): 
        zc = 0
        oc = 0
        idsum = 0
        for j in range(0, n): 
            if (arr[j] % 2 == 0): 
                zc += 1
            else: 
                oc += 1
            arr[j] = int(arr[j] / 2) 
        idsum = oc * zc * (1 << i) 
        s += idsum
    return s
  
print(calc_sum(a, len(a), m)%MOD)