import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val A = nextLongList().toMutableList()
    var ans = 0L
    var base = 1L
    for (d in 1..60) {
        var one = 0L
        var zero = 0L
        for (i in A.indices) {
            if (A[i] and 1 == 0L) {
                zero++
            } else {
                one++
            }
            A[i] = A[i] shr 1
        }
        ans = ((ans + ((one * zero) % 1000000007L) * base) % 1000000007L) % 1000000007L
        base *= 2
    }
    println(ans)
}