import java.io.*
import java.util.*

fun solve(N: Int, A: LongArray){
    A.sort()
    val MOD = 1000000007L
    var ans = 0L
    for (i in 0..60){
        val bitSum = A.map{ it shr i and 1 }.sum().toLong()
        val comb = ((N.toLong() - bitSum) * bitSum) % MOD
        ans += (comb shl i) % MOD
    }
    println(ans % MOD)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val A = LongArray(N)
    for (i in 0 until N) {
        A[i] = sc.next().toLong()
    }
    solve(N, A)
}

