from itertools import combinations
from operator import xor
from functools import lru_cache


@lru_cache(maxsize=None)
def xor_w_cache(x, y):
    _xor = xor
    return _xor(x, y) % R


N = int(input())
A = map(int, input().split())
R = 10 ** 9 + 7

print(sum(xor_w_cache(x, y) for x, y in combinations(A, 2)) % R)
