n = gets.to_i
A = gets.split.map(&:to_i)

mod = 10 ** 9 + 7
sum = 0

60.times do |i|
   count = A.count do |ai|
     ai[i] == 1
   end
  sum += ( count * (n - count) * (1 << i) ) % mod
end

puts sum % mod