fun main(args: Array<String>) {
    val MOD = 1000000007L
    val N = nextLong()
    val A = listOfLong()
    val C = Array<Long>(61) { 0L }
    for (a in A) {
        for (b in 0 until 61) {
            C[b] += (a shr b) % 2
        }
    }
    var ans = 0L
    for (b in 0 until 61) {
        ans += (C[b] * (N - C[b]) shl b) % MOD
        ans %= MOD
    }
    println(ans)
}
fun next() = readLine()!!
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }