# -*- coding: utf-8 -*-
# 多分TLE
import numpy as np
from collections import deque
mod = 10**9 + 7
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]) % mod
print(ans % mod)
