fun main(args: Array<String>) {
    val mod = 1000000007
    val n = readLine()!!.toInt()
    val an = readLine()!!.split(" ").map(String::toLong)

    var sum = 0L
    var pre = an[0]
    for (i in 0 until an.size - 1) {
        for (l in i + 1 until an.size) {
            sum += an[i].xor(an[l])
            sum %= mod
        }
    }
    println(sum)
}


