Imports System

Public Class Program

    Public Shared Sub Main(args As String())
        Const M As Decimal = 1000000007

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

        Dim sum As Decimal = 0

        For Each d As Decimal In A

            For k As Integer = 0 To 59
                If 2 ^ k And d Then
                    b(k) += 1
                End If
            Next

        Next

        For i As Integer = 0 To 59
            sum += (b(i) * (N - b(i))) * 2 ^ i
            sum = sum Mod M
        Next

        Console.WriteLine(sum)

    End Sub
End Class
