#include <bits/stdc++.h>
using namespace std;
long long a[100100], g[100100], dp0[100100], dp1[100100], dp2[100100],
    dp3[100100];
int p1[100100], p2[100100], p3[100100];
long long sum(int l, int r) { return g[l] - g[r]; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0); i <= (n - 1); i++) scanf("%I64d", &a[i]);
  for (int i = n - 1; i >= 0; i--) g[i] = g[i + 1] + a[i];
  for (int i = 0; i <= n; i++) dp0[i] = sum(0, i);
  for (int i = 0; i <= n; i++)
    dp1[i] = dp2[i] = dp3[i] = -(long long)0x3f3f3f3f * 0x3f3f3f3f;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++)
      if (dp1[i] < dp0[j] - sum(j, i)) {
        dp1[i] = dp0[j] - sum(j, i);
        p1[i] = j;
      }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++)
      if (dp2[i] < dp1[j] + sum(j, i)) {
        dp2[i] = dp1[j] + sum(j, i);
        p2[i] = j;
      }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++)
      if (dp3[i] < dp2[j] - sum(j, i)) {
        dp3[i] = dp2[j] - sum(j, i);
        p3[i] = j;
      }
  }
  printf("%d %d %d\n", p1[p2[p3[n]]], p2[p3[n]], p3[n]);
}
