#include <bits/stdc++.h>
using namespace std;
const int N_LIMIT = 100001;
int argmin(vector<long long> vec, int start, int end) {
  long long bestValue = vec[start];
  int bestIndex = start;
  for (int i = start + 1; i <= end; ++i) {
    if (vec[i] < bestValue) {
      bestIndex = i;
      bestValue = vec[i];
    }
  }
  return bestIndex;
}
int main(int argc, char *argv[]) {
  int n;
  vector<long long> a;
  vector<long long> sums;
  long long total = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int inp;
    cin >> inp;
    a.push_back(inp);
    total += inp;
  }
  for (int i = 0; i <= n; ++i) {
    sums.push_back(total);
    total -= a[i];
  }
  int bestIndex = 0;
  long long bestValue = -sums[0];
  for (int i = 1; i <= n; i++) {
    int i1, i2;
    long long value;
    i1 = argmin(sums, 0, i);
    i2 = argmin(sums, i, n);
    value = sums[0] - 2 * sums[i1] + 2 * sums[i] - 2 * sums[i2];
    if (value > bestValue) {
      bestValue = value;
      bestIndex = i;
    }
  }
  cout << argmin(sums, 0, bestIndex) << " " << bestIndex << " "
       << argmin(sums, bestIndex, n) << endl;
  return 0;
}
