import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val A = Array.fill(N)(sc.nextLong)

    var ans = 0L
    for (i <- 0 until N - 1) {
      for (j <- (i + 1) until N) {
        ans += A(i) ^ A(j)
        ans %= 1000000007
      }
    }

    ans.toString
  }
}
