

import java.util.Scanner
val scanner = Scanner(System.`in`)

fun main(args: Array<String>){
    var n = scanner.nextInt()
    var aa = (0 until n).map{ scanner.nextLong() }.toLongArray()

    var pos = aa[0] + aa[1]
    var neg = -pos

    for (i in 2 until n) {
        val la = aa[i - 1]
        val a = aa[i]
        val p = Math.max( pos + a, neg + a)
        val n= Math.max( pos -la*2 - a, neg + la*2 - a)
        pos = p
        neg = n
    }

    println(Math.max(pos, neg))

}



