import sys
input = sys.stdin.buffer.readline
import numpy as np

def main():
    N = int(input())
    INF = 10**9+7
    A = list(map(int,input().split()))
    M = max(A)
    l = M.bit_length()
    d = np.array([[0,0] for _ in range(l)])
    for i in range(N):
        num = A[i]
        count = 0
        while count != l:
            use = num%2
            d[count][use] += 1
            num //= 2
            count += 1
        
    ans = 0    
    for i in range(l):
        x,y = d[i]
        ans += (x*y)*(2**i)
        ans %= INF
        
    print(ans)

if __name__ == "__main__":
    main()
