#include <bits/stdc++.h>
using namespace std;
int n;
int a[100011];
int tot[100011];
int MN[100011];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    tot[i] = tot[i - 1] + a[i];
  }
  MN[0] = 0;
  for (int i = 1; i <= n; i++)
    MN[i] = ((MN[i - 1]) < (tot[i]) ? (MN[i - 1]) : (tot[i]));
  int ans = -1000000000;
  for (int i = 0; i <= n; i++) {
    int rlt = tot[n] - 2 * (tot[n] - tot[n - i]);
    rlt -= 2 * MN[n - i];
    ans = ((ans) > (rlt) ? (ans) : (rlt));
  }
  printf("%d\n", ans);
}
