object Main extends scala.App {
    import java.util
    import scala.collection._
    import scala.collection.mutable.ListBuffer
    import scala.math._

    val mod = (pow(10.0, 9) + 7).toInt
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt()

    val buf = ListBuffer.empty[Long]
    for (i <- 0 until N) {
        buf += sc.nextLong()
    }
    val ary = buf.toList

    var result = 0L
    for (i <- 0 until (N-1)) {
        for (j <- (i+1) until N) {
            result += (ary(i) ^ ary(j)) % mod
            result %= mod
        }
    }
    println(result)
}