import std.functional,
       std.algorithm,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.math;

T read_num(T)() { return readln.chomp.to!T; }
T[] read_nums(T)() { return readln.chomp.split.to!(T[]); }

enum INF = 1L << 30;

T max(T)(T a, T b) { return a < b ? b : a; }

void main() {
  long N = read_num!long;
  long[] A = read_nums!long;
  long[2][] dp;
  dp.length = N + 1;

  dp[0][0] = 0;
  dp[0][1] = -INF;

  for (size_t i = 0; i < N; i++) {
    long a = A[i];
    dp[i + 1][0] = max(dp[i][0] + a, dp[i][1] - a);
    dp[i + 1][1] = max(dp[i][0] - a, dp[i][1] + a);
  }

  writeln(dp[N][0]);
}