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 = 1000000007L

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

    return ans.toString()
}
