N = int(input())
As = list(map(int, input().split()))

def from10to2(x):
  y = []
  while x>0:
    a = x//2
    b = x%2
    y.append(b)
    x = a
  return y[::-1]

def from2to10(y):
  y = y[::-1]
  n = len(y)
  x = 0
  for i in range(n):
    x += y[i] * 2**i
  return x

def xor(A,B):
  A2 = from10to2(A)
  B2 = from10to2(B)
  C = []
  num = max(len(A2),len(B2))
  
  if len(A2)<num:
    A2_ = [0 for i in range(num-len(A2))]
    A2 = A2_ + A2
  elif len(B2)<num:
    B2_ = [0 for i in range(num-len(B2))]
    B2 = B2_ + B2
  
  for i in range(num):
    if A2[i]+B2[i]==1:
      C.append(1)
    else:
      C.append(0)
  return from2to10(C)
    

sum = 0
for i in range(N-1):
  for j in range(i+1,N):
    sum += xor(As[i],As[j])
    
ans = sum % (7 + 1e+9)
print(int(ans))
  