#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    zeros = [0 for _ in range(60)]
    ones = [0 for _ in range(60)]
    for a in A:
        for i in range(60):
            if (a >> i) & 1:
                ones[i] += 1
            else:
                zeros[i] += 1

    res = 0
    for a in A:
        for i in range(60):
            if (a >> i) & 1:
                res += zeros[i] << i
                res %= MOD
            else:
                res += ones[i] << i
                res %= MOD
    if res % 2 == 1:
        res = res + MOD
    print(res // 2)
        
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
