object Main extends App {
  val n = io.StdIn.readLine().toInt
  val numbers = io.StdIn.readLine().split(' ').map(BigInt.apply).toList
  
  def sumxor(rest: List[BigInt], acc: BigInt): BigInt = rest match {
    case x :: Nil => acc
    case x :: xs =>
    	sumxor(xs, acc + xs.map(_ ^ x).sum)
  }
  
  val answer = sumxor(numbers, BigInt(0)) % BigInt("1000000007")
  println(answer)
}