MOD = 1000000007
BITS = 61
n = gets.to_i
a = gets.split.map(&:to_i)

ans = 0

BITS.times {|b|
    popcnt = 0
    m = 1 << b
    a.each {|x|
        popcnt += 1 if x & m != 0
    }
    ans += popcnt * (n-popcnt) * 2**b
}

p ans % MOD