Public Class Program
  Shared Sub Main()
    Const M As Long = 1000000007
    Dim n As Long = Long.Parse(Console.ReadLine())
    Dim a As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim ans As Long = 0
    For i As Long = 0 To n - 2
      For j As Long = i + 1 To n - 1
        ans += (a(i) Xor a(j)) Mod M
        ans = ans Mod M
      Next
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class