# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
mod = 10**9 + 7

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

s = 0
for i in range(n-1):
    for j in range(i+1,n):
        s += a[i]^a[j]
        s %= mod
print(s)