fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var xs = readLine()!!.split(" ").map(String::toInt)
    var a1 = 0L
    var a2 = -1000000000000L
    for (i in 0 until n) {
        var t = Math.max(a1 + xs[i], a2 - xs[i])
        a2 = Math.max(a1 - xs[i], a2 + xs[i])
        a1 = t
    }
    println(a1)
}