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: " "))
    }
}


class Solution {
    func find(_ arr: [Int]) -> Int {
        var ones = [Int](repeating: 0, count: 64)
        var zeros = [Int](repeating: 0, count: 64)
        for num in arr {
            for i in stride(from: 0, to: 64, by: 1) {
                if num & (1<<i) != 0 {
                    ones[i] += 1
                } else {
                    zeros[i] += 1
                }
            }
        }
        var res = 0
        for i in stride(from: 0, to: 64, by: 1) {
            res = (res + (zeros[i] * ones[i]) * (1<<i))%1000000007
        }
        return res
     }
}


let n = Scanner.readInt()
let arr = Scanner.readIntArr()
let sol = Solution()
print(sol.find(arr))