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

    val MOD = 1000000007
    var sum = 0L

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

    println(sum)
}
