#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
#pragma GCC optimize("O3")
using namespace std;
const long long N = 1e5 + 10;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const long long inf = -1e18;
const long long M = 1e6;
long long n, pf[N], ans, ans1, ans2, ans3, a[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pf[i] = pf[i - 1] + a[i];
  }
  for (int i = 0; i <= n; i++) {
    long long mx = inf, imx = 0, jmx = 0, mx1 = inf;
    for (int j = 0; j <= i; j++) {
      if (mx < (pf[j] - pf[0]) - (pf[i] - pf[j])) {
        mx = (pf[j] - pf[0]) - (pf[i] - pf[j]);
        imx = j;
      }
    }
    for (int j = i; j <= n; j++) {
      if (mx1 < (pf[j] - pf[i]) - (pf[n] - pf[j])) {
        mx1 = (pf[j] - pf[i]) - (pf[n] - pf[j]);
        jmx = j;
      }
    }
    if (mx + mx1 > ans) {
      ans = mx + mx1;
      ans1 = imx;
      ans2 = i;
      ans3 = jmx;
    }
  }
  cout << ans1 << " " << ans2 << " " << ans3;
  cin.get(), cin.get();
  return 0;
}
