import java.io.{BufferedReader, InputStreamReader}

object ModN {
  implicit def toModN(n: Long): ModN = {
    new ModN(n)
  }
}

class ModN(n: Long) {
  val MOD = 1000000007L

  def +(other: ModN): ModN = {
    new ModN((n + other.toLong) % MOD)
  }

  def *(other: ModN): ModN = {
    new ModN((n * other.toLong) % MOD)
  }

  val toLong: Long = n % MOD
}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s").map(_.toLong)

    val cs = Array.ofDim[Int](60)

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

    val ans = (0 until 60).foldLeft(new ModN(0L)) { case (acc, shift) =>
      acc + (0 until shift).foldLeft(new ModN(cs(shift) * (n - cs(shift)))) { case (acc2, _) =>
        acc2 * 2L
      }
    }

    System.out.println(ans.toLong)
  }
}
