N = gets.to_i
A = gets.split.map &:to_i

bits_count = (0..60).map{|i| A.count{|a| a[i] == 1}}
ans_bin = bits_count.map{|count| (count * (N - count)) % (10**9 + 7)}
ans = 0
ans_bin.each_with_index do |x, i|
    ans = (ans + (x << i)) % (10**9 + 7)
end
p ans