    N = int(input())
    a = list(map(int,input().split()))
     
    z=0
    m=10**9+7
     
    for i in range(0,N-1):
      for j in range(i+1,N):
    #    print(i,j)
    #    print(a[i],a[j])
        z+=int(a[i])^int(a[j])
    print(z%m)