func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let _ = readLine()!
    let a_tachi = readInts().sorted(by: <)
    
    var sum = 0
    for i in 1..<a_tachi.count {
        sum += a_tachi[i]
    }
    
    print(sum)
}

main()
