def main():
  import sys
  input = sys.stdin.readline
  n=int(input())
  a=tuple(map(int,input().split()))
  ll=len(bin(max(a)))+1
  mod=pow(10,9)+7
  x=[0]*63
  for i in a:
    i=bin(i)
    l=len(i)-1
    for j in range(1,l):
      if i[-j]=='1':
        x[j]+=1
  ans=0
  for i in range(1,ll):
    ans+=pow(2,i-1,mod)*(x[i]%mod)*((n-x[i])%mod)%mod
    ans%=mod
  print(ans)
if __name__=='__main__':
  main()