p = 10**9 + 7
n = int(input())
a = list(map(int,input().split()))
def f(a):
  if sum(a) == 0:
    return(0)
  else:
    r = sum([x%2 for x in a])
    b = [x//2 for x in a]
  return((r*(n-r) + 2*f(b))%p)
print(f(a))