MOD = 1_000_000_007_i64
n = gets.to_s.to_i
a = gets.to_s.split.map { |v| v.to_i64 }
cnt = Array.new(60, 0_i64)

a.each do |v|
  60.times do |i|
    cnt[i] += 1 if v >> i & 1 == 1
  end
end

ans = 0_i64
cnt.each_with_index do |v, i|
  ans += v * (n - v) * 2_i64 ** i
  ans %= MOD
end
puts ans
