import java.io.{BufferedReader, InputStreamReader}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val mod = 1000000000L + 7

    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toLong)
    val cs = new Array[Int](60)

    as.foreach { a =>
      (0 until 60).foreach { shift =>
        if ((a >> shift & 1) == 1) {
          cs(shift) += 1
        }
      }
    }

    @tailrec
    def shift(n: Long, bit: Int): Long = {
      if (bit == 0) {
        n
      } else {
        shift((n << 1) % mod, bit - 1)
      }
    }

    System.out.println(
      cs.zipWithIndex.foldLeft(0L) { case (acc, (c, i)) =>
        (acc + shift(c *(n - c), i)) % mod
      }
    )
  }
}
