import java.util.*

fun main(args: Array<String>) {
    val result = solve(Scanner(System.`in`))
    if (result.isNotEmpty()) println(result)
}

fun solve(`in`: String) = solve(Scanner(`in`))

fun solve(sc: Scanner): String {
    val N = sc.nextInt()
    val A = (1..N).map { sc.nextLong() }

    var r: Long = 0L
    for (b in (0..62)) {
        val bn = 1L shl b
        val a = A.map { it and bn != 0L }
        val n = a.count { it } * a.count { !it }
        for (i in 0 until n) {
            r += bn
            r %= 1000000007
        }
    }

    return r.toString()
}
