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