import sys
from itertools import combinations

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
LIST = lambda: list(map(int, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

    cnt = 0
    for i, j in list(combinations(A, 2)):
        cnt += int(bin(i ^ j), 2)

    print(cnt % mod)


if __name__ == '__main__':
    main()
