Public Class Program
  Shared Sub Main()
    Const M As Long = 1000000007
    Const Index As Integer = 60
    Dim n As Long = Long.Parse(Console.ReadLine())
    Dim b(0 To Index - 1) As Long
    Dim ans As Long = 0
    For Each x As Long In Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
      For i As Integer = 0 To Index - 1
        If (x And Math.Pow(2, i)) > 0 Then b(i) += 1
      Next
    Next
    For i As Integer = 0 To Index - 1
      ans += (b(i) * (n - b(i))) * Math.Pow(2, i)
    Next
    ans = ans Mod M
    Console.WriteLine(ans.ToString())
  End Sub
End Class