import java.util.Scanner

fun a(sc: Scanner): String {
    if (sc.nextInt() + sc.nextInt() + sc.nextInt() < 22) {
        return "win"
    }
    return "bust"
}

fun b(sc: Scanner): String {
    val s = sc.next()
    val sr = s.reversed()
    val l = s.length
    var ans = 0
    s.forEachIndexed { index, c ->
        if (index * 2 >= l) {
            return ans.toString()
        }
        if (c != sr[index]) ans++
    }
    return "0"
}

fun c(sc: Scanner): String {
    val N = sc.nextInt()
    val arr = (0 until N).map {
        (0 until sc.nextInt()).map {
            Pair(sc.nextInt(), sc.nextInt())
        }
    }
    val ans = (0 until (2.shl(N - 1))).map { pat ->
        if (arr.withIndex().all { a ->
                pat shr (a.index) and 1 == 0 ||
                        a.value.all {
                            pat.getBit(it.first) == it.second
                        }
            }) {
            (0 until N).count {
                pat.getBit(it) == 1
            }
        } else {
            0
        }
    }.max().toString()
    return ans
}

fun d(sc: Scanner): String {
    var ans = 0L
    val list = (0 until sc.nextInt()).map { sc.nextLong() }
    return (list.withIndex().flatMap { x ->
        list.drop(x.index + 1).map { y ->
            (x.value xor y)
        }
    }.sum() % 1000000007).toString()
}

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    println(
//        a(sc)
//        b(sc)
//    c(sc)
        d(sc)
    )
}

fun Int.getBit(index: Int): Int = (this shr index) and 1

fun Int.loop(f: () -> Unit) {
    for (x in 0 until this) f()
}