from scipy.special import comb
import numpy as np

N = int(input())
numbers = np.array(list(map(int,input().split(" "))))

conv = itertools.combinations(numbers, r=2)

print(sum([j[0]^j[1] for j in conv])%(10**9+7))