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