# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)
sum = 0

MOD = 10**9 + 7
60.times do |b|
  count = 0
  x = 2**b
  n.times do |i|
    count += 1 if (a[i] & x).zero?
  end
  sum += count * (n - count) * x
end

puts sum % MOD
