# -*- coding: utf-8 -*-
from functools import reduce

# input
n = int(input())
alist = list(map(int, input().split()))

# processing
l = []

i = 0
while i < n-1:
    j = i + 1
    while j < n:
        l.append(alist[i]^alist[j])
        j+=1
    i+=1

# output
print(reduce(lambda x, y: x+y, l) % (10**9+7))
