[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let N = read int
    let AS = reada int64

    let dp = Array2D.create (N + 1) 2 0L
    dp.[0,1] <- -1000000007L
    for i in [1 .. N] do
        let ai = AS.[i-1]
        dp.[i,0] <- max
            (dp.[i-1,0] + ai)
            (dp.[i-1,1] - ai)
        dp.[i,1] <- max
            (dp.[i-1,0] - ai)
            (dp.[i-1,1] + ai)

    printfn "%i" dp.[N,0]
    0