! 2019.12.8
!
      program answer
      implicit none
      integer :: N
      integer(8),allocatable,dimension(:) :: A
      integer,dimension(60) :: B1,B2
      integer(8) :: num
      integer(8) :: quo
      integer(8) :: ans
      integer(8) :: i,j
!
      quo = 10**9+7
      ans = 0
      do i=1,60
        B1(i) = 0
        B2(i) = 0
      end do
      num = 0
!
      read(*,*) N
      allocate(A(N))
!
      read(*,*) (A(i),i=1,N)
!
      do i=1,N-1
        call mk_array(B1,60,A(i))
        do j=i+1,N
          call mk_array(B2,60,A(j))
          call XOR(B1,B2,60,num)
          ans = mod(num+ans,quo)
!          write(*,*) B2(1),B2(2),B2(3)
        end do
!        write(*,*) B1(1),B1(2),B1(3)
      end do
      write(*,*) ans
      end program answer
!------------------------------------------------
      subroutine mk_array(J,N,M)
!------------------------------------------------
      implicit none
      integer,intent(in) :: N
      integer(8),intent(in) :: M
      integer,dimension(N),intent(inout) :: J
      integer :: i
      integer :: cyc
      integer(8) :: aaa
      intrinsic mod
! initialization
      do i=1,N
        J(i) = 0
      end do
! 
      aaa = M
      cyc = 1
      do
        if(mod(aaa,2) == 1) then
          J(cyc) = 1
        else
          J(cyc) = 0
        end if
        cyc = cyc + 1
        aaa = aaa / 2
        if( aaa == 0) exit
      end do
      end subroutine mk_array
!------------------------------------------------
      subroutine XOR(A1,A2,N,res)
!------------------------------------------------
      implicit none
      integer :: N
      integer,dimension(N) :: A1,A2
      integer,dimension(N) :: B
      integer(8) :: res
      integer :: i
!
      do i=1,N
        if(A1(i) == A2(i)) then
          B(i) = 0
        else
          B(i) = 1
        end if
      end do
!
      res = 0
      do i=1,N
        res = res + 2**(i-1)*B(i)
      end do
      end subroutine XOR