#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, m;
int pos[maxn];
long long a[maxn], sm[maxn], dp[maxn];
long long calc(int l, int r) { return sm[r - 1] - sm[l - 1]; }
int main() {
  sm[0] = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    sm[i] = sm[i - 1] + a[i];
  }
  long long ans = -0x3f3f3f3f3f3f3f3f;
  int p1, p2, p3;
  for (int i = 0; i <= n; ++i) {
    long long now = sm[i];
    int pos = i;
    for (int j = i; j <= n; ++j) {
      if (sm[j] < now) {
        now = sm[j];
        pos = j;
      }
      long long tmp = calc(1, i + 1) - calc(i + 1, pos + 1) +
                      calc(pos + 1, j + 1) - calc(j + 1, n + 1);
      if (tmp > ans) {
        ans = tmp;
        p1 = i, p2 = pos, p3 = j;
      }
    }
  }
  printf("%d %d %d\n", p1, p2, p3);
  return 0;
}
