fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfLong()
    var ans = 0L
    for (i in 0 until N-1) {
        for (j in i+1 until N) {
            ans += (A[i] xor A[j])
            ans %= 1000000007L
        }
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }