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 => (a >> d) & 1L).sum).map(m => (n - m) * m % MOD)
						.zipWithIndex.map {case (m, d) => (m * (1L << d) % MOD) % MOD }
						.reduce((a, b) => (a + b) % MOD))
}