import java.lang.Math

val MOD: Int = 1000000000 + 7
val MODL: Long = MOD.toLong()

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

    var ans = 0L
    for (i in 0 until n-1) {
        for (k in i until n) {
            ans = (ans % MODL + (a[i] xor a[k]) % MODL) % MODL
        }
    }

    println(ans)
}
