object Main extends App {
  val n  = io.StdIn.readLine().toInt
  val an: Array[Long] = io.StdIn.readLine().split(' ').map(_.toLong)
  val m = (Math.pow(10, 9) + 7).toLong
  var sum: Long = 0
  for (i <- 0 until n)
    for (j <- i until n) {
      sum += (an(i) ^ an(j))
    }
  println(sum % m)
}
