import Foundation

class Scanner {
    static func readInt() -> Int {
        return Int(readLine()!)!
    }
    
    static func readIntArr() -> [Int] {
        return readLine()!.split(separator: " ").map { Int($0)! }
    }
    
    static func readM(_ n: Int) -> [[Int]] {
        var res = [[Int]]()
        for _ in 0..<n {
            res.append(readIntArr())
        }
        return res
    }
    
    static func readUknownIntMat() -> [[Int]] {
        var res = [[Int]]()
        while let line = readLine() {
            res.append(line.split(separator: " ").map { Int($0)! })
        }
        return res
    }
    
    static func readString() -> String {
        return readLine()!
    }
}

class Printer {
    static func printIntArray(_ arr: [Int]) {
        print(arr.map { String($0) }.joined(separator: " "))
    }
}

var arr = [Int](repeating: 0, count: 64)
let n  = Scanner.readInt()
let nums = Scanner.readIntArr()
for num in nums {
    for i in stride(from: 0, to: 64, by: 1) {
        let j = 1<<i
        arr[64-i-1] += (num&j != 0 ? 1 : 0)
        
    }
}
var res = 0
for i in stride(from: 63, through: 0, by: -1) {
    let j = 1<<(64-i-1)
    res = (res + (((j)%1000000007 * (arr[i]%1000000007))%1000000007 * (nums.count-arr[i])))%1000000007
}
print(res)
