fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toLong() }
    val mod = 1000000009

    var res = 0L
    var twoFactor = 1
    for(d in 0 until 60){
        var even = 0
        var odd = 0
        for(i in 0 until N){
            if((A[i] shr d) and 1L == 1L){
                odd++
            }else{
                even++
            }
        }
        val add = (((odd * even) % mod) * twoFactor) % mod
        res = (res + add) % mod
        twoFactor = (twoFactor * 2) % mod
    }
    println(res)
}