import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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


if __name__ == '__main__':
    main()