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() }
    val nA = A.count()
    val MOD = 1000000007

    var ans: Long = 0L
    for (b in 0..61) {
        val bn = 1L shl b
        val n0 = A.count { it and bn == 0L }
        ans += bn * (n0 * (nA - n0))
        ans %= MOD
    }

    return ans.toString()
}
