#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
const long long MAX = 100000000LL * 100000000LL;
const long long MIN = numeric_limits<long long>::min();
const double PI = 3.14159265358979;
const long long MOD = 1000000007LL;
template <class T>
ostream& operator<<(ostream& out, vector<T>& v) {
  for (int i = 0; i < v.size(); ++i) out << v[i] << " ";
  return out;
}
template <class T>
istream& operator>>(istream& in, vector<T>& v) {
  for (int i = 0; i < v.size(); ++i) in >> v[i];
  return in;
}
template <class L, class R>
istream& operator>>(istream& in, pair<L, R>& p) {
  in >> p.first >> p.second;
  return in;
}
template <class T>
T lexical_cast(string& s) {
  stringstream ss(s);
  T t;
  ss >> t;
  return t;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long cdiv(long long a, long long b) { return (a + b - 1) / b; }
long long inv(long long n, long long mod) {
  long long pow = mod - 2;
  long long ans = 1;
  long long cur = n;
  while (pow > 0) {
    if (pow & 1) {
      ans *= cur;
      ans %= mod;
    }
    pow /= 2;
    cur *= cur;
    cur %= mod;
  }
  return ans;
}
template <class Cont>
void sort(Cont& c) {
  sort(begin(c), end(c));
}
template <class Cont>
void reverse(Cont& c) {
  reverse(begin(c), end(c));
}
struct part {
  long long res;
  int d1, d2, d3;
};
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  cin >> a;
  vector<long long> sum(n + 1);
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + a[i];
  }
  part ans = {MIN, 0, 0, 0};
  for (int d2 = 0; d2 <= n; ++d2) {
    part left = {MIN, 0, 0, 0};
    for (int d1 = 0; d1 <= d2; ++d1) {
      if (2 * sum[d1] - sum[d2] >= left.res) {
        left.res = 2 * sum[d1] - sum[d2];
        left.d1 = d1;
      }
    }
    part right = {MIN, 0, 0, 0};
    for (int d3 = d2; d3 <= n; ++d3) {
      if (2 * sum[d3] - sum[d2] - sum[n] >= right.res) {
        right.res = 2 * sum[d3] - sum[d2] - sum[n];
        right.d3 = d3;
      }
    }
    if (ans.res <= left.res + right.res) {
      ans = {left.res + right.res, left.d1, d2, right.d3};
    }
  }
  cout << ans.d1 << " " << ans.d2 << " " << ans.d3;
}
