import sys

input = sys.stdin.readline

def main():
    MOD = 10**9+7
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    k = 1
    
    for i in range(60):
        c = 0
        for j in range(N):
            if A[j] & 1: c += 1
            A[j] = A[j] >> 1
        ans += c * (N-c) * k
        ans %= MOD
        k *= 2
            
    print(ans)

if __name__ == '__main__':
    main()  