#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 5;
const long long inf = (1LL) << 60;
long long a[maxn];
long long sum[maxn];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
  }
  sum[0] = a[0];
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + a[i];
  }
  long long _max = -sum[n - 1];
  int res1 = 0, res2 = 0, res3 = 0;
  for (int k = 0; k <= n; k++) {
    long long left_max = 0;
    long long left_sum, right_sum;
    int left_delim = 0, right_delim = k;
    for (int i = 0; i <= k; i++) {
      left_sum = i == 0 ? 0 : sum[i - 1];
      right_sum = sum[k - 1] - (i == 0 ? 0 : sum[i - 1]);
      if (left_max < left_sum - right_sum) {
        left_max = left_sum - right_sum;
        left_delim = i;
      }
    }
    long long right_max = 0;
    for (int i = k; i <= n; i++) {
      left_sum = sum[i - 1] - (k == 0 ? 0 : sum[k - 1]);
      right_sum = sum[n - 1] - (i == 0 ? 0 : sum[i - 1]);
      if (right_max < left_sum - right_sum) {
        right_max = left_sum - right_sum;
        right_delim = i;
      }
    }
    if (left_max + right_max > _max) {
      res1 = left_delim;
      res2 = k;
      res3 = right_delim;
      _max = left_max + right_max;
    }
  }
  printf("%d %d %d\n", res1, res2, res3);
  return 0;
}
