Imports System

Public Class Program

    Public Shared Sub Main(args As String())

        Dim N As Integer = Integer.Parse(Console.ReadLine)
        Dim A() As ULong = Array.ConvertAll(Of String, ULong)(Console.ReadLine.Split(" "), AddressOf ULong.Parse)

        Dim sum As ULong = 0

        For i As Integer = 0 To N - 2

            For j As Integer = i + 1 To N - 1

                sum = (sum + (A(i) Xor A(j)))

            Next
            sum = sum Mod 1000000007
        Next

        Console.WriteLine(sum)

    End Sub
End Class