      PROGRAM xorSum
      IMPLICIT NONE
      integer(16),allocatable :: a(:)
      integer(16) :: n
      integer(16) :: i,j,ans
      integer(16),parameter :: m = 10**9 + 7
      
      read*,n
      allocate( a(n) )
      read*,a
    !  do i = 1,n
    !    a(i) = mod(a(i),m)
    !  end do
      
      ans = 0
      do i = 1,n-1
        do j = i+1,n
          ans = ans + xor(a(i),a(j))
          ans = mod(ans,m)
        end do
      end do
      
      print*,ans
      END PROGRAM