import sys
input = sys.stdin.readline

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

    ans = 0
    MOD = 10**9+7
    k = 1
    for i in range(60):
        c = 0
        for j in range(N):
            c += A[j] & 1
            A[j] >>= 1
        ans = (ans + c * (N-c) * k) % MOD
        k = (2*k) % MOD

    print(ans)
    
if __name__ == '__main__':
    main()