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 k As Integer = 0 To 59


            Dim cntone As Integer = 0

            For i As Integer = 0 To N - 1
                If (A(i) >> k) And 1 Then
                    cntone += 1
                End If

            Next

            Dim cntzero As Integer = N - cntone
            sum = sum + (cntone * cntzero) * 2 ^ k
            sum = sum Mod 1000000007

        Next

        Console.WriteLine(sum)

    End Sub
End Class