import copy
"""
n = int(input())
a = []
x = []
y = []
x_dash = []
y_dash = []
for i in range(n):
	a.append(int(input()))
	for _ in range(a[i]):
		x_dash_dash, y_dash_dash = map(int,input().split())
		x_dash.append(x_dash_dash)
		y_dash.append(y_dash_dash)
	tmp_x = copy.deepcopy(x_dash)
	tmp_y = copy.deepcopy(y_dash)
	x.append(tmp_x)
	y.append(tmp_y)
	x_dash.clear()
	y_dash.clear()

for i in range(n):
	A = [-1 for _ in range(n)]
	A[i] = 1
	for j in range(x[i]):
		A[x[i][j]] == y[i][j]
	c = 1
	while c == n:
		for k in range(x[i+c]):
			if A[i+c] == :

		if A[i+c] != -1:
			c += 1"""

n = int(input())
a = list(map(int,input().split()))

ans = 0

for i in range(n-1):
	for j in range(i+1,n):
		ans += a[i] ^ a[j]
print(ans % (10**9+7))
