object Main extends App {
	val sc = new java.util.Scanner(System.in)
	val n  = sc.nextInt
	val as = Array.fill(n)(sc.nextLong)
	
	val MOD = 1000000007
	
	println((0 until 60).map(d => as.map(a => if((a & (1L << d)) != 0) 1 else 0).sum)
						.map(m => ((n - m) * m) % MOD)
						.zipWithIndex.map {case (m, d) => (m * (1L << d) % MOD) % MOD }.sum % MOD)
}