#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long int arr[n + 1], dp[n + 1];
  dp[0] = 0LL;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    dp[i] = dp[i - 1] + arr[i];
  }
  long long int ans = -1e18, ind1, ind2, ind3;
  dp[n + 1] = dp[n];
  for (int i = 1; i <= n; i++) {
    long long int tot = 0;
    long long int temp = -1e18, l, r;
    for (int j = 1; j <= i; j++) {
      long long int temp2 = dp[j - 1] - dp[0];
      temp2 -= dp[i - 1] - dp[j - 1];
      if (temp2 > temp) {
        temp = temp2;
        l = j;
      }
    }
    tot += temp;
    temp = -1e18;
    for (int j = i; j <= n + 1; j++) {
      long long int temp2 = dp[j - 1] - dp[i - 1];
      temp2 -= dp[n + 1] - dp[j - 1];
      if (temp2 > temp) {
        temp = temp2;
        r = j;
      }
    }
    tot += temp;
    if (tot > ans) {
      ans = tot;
      ind1 = l;
      ind2 = i;
      ind3 = r;
    }
  }
  cout << ind1 - 1 << " " << ind2 - 1 << " " << ind3 - 1 << endl;
  return 0;
}
