val MOD = 1000000007

fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toLong() }

    var sum = 0L
    for (i in 0..n-2) {
        for (j in i+1..n-1) {
            sum += (aa[i].xor(aa[j]) % MOD)
            sum %= MOD
        }
    }

    println(sum)
}