#include <bits/stdc++.h>
using namespace std;
template <typename T>
T prod(const T &a, const T &b, const T &mod) {
  return ((a % mod) * (b % mod)) % mod;
}
template <typename T>
T pow_(const T &a, const T &b) {
  if (!b) return 1;
  T p = pow_(a, b / 2);
  p *= p;
  return (b % 2) ? (p * a) : p;
}
template <typename T>
T modpow(const T &a, const T &b, const T &mod) {
  if (!b) return 1;
  T p = modpow(a, b / 2);
  p = prod(p, p);
  return (b % 2) ? (prod(p, a)) : p;
}
template <typename T>
T max(const T &a, const T &b, const T &c) {
  return max(a, max(b, c));
}
template <typename T>
T min(const T &a, const T &b, const T &c) {
  return min(a, min(b, c));
}
template <typename T>
void dbg(const vector<T> &a, int l, int r) {
  for (long long int i = l; i <= r; i++) cout << a[i] << " ";
  cout << endl;
}
template <typename T>
void dbg(const vector<T> &a) {
  for (long long int i = 0; i <= a.size() - 1; i++) cout << a[i] << " ";
  cout << endl;
}
void main_() {
  long long int n;
  cin >> n;
  vector<long long int> a(n + 1, 0);
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  long long int x, y, z;
  long long int res = -LLONG_MAX;
  for (long long int i = 0; i <= n; i++) {
    long long int m1 = -LLONG_MAX, m2 = -LLONG_MAX;
    long long int y_, x_, z_;
    y_ = i;
    for (long long int j = 0; j <= i; j++) {
      if (m1 < a[j]) {
        m1 = a[j];
        x_ = j;
      }
    }
    for (long long int j = i; j <= n; j++) {
      if (m2 < a[j]) {
        m2 = a[j];
        z_ = j;
      }
    }
    long long int sum = 2 * (a[x_] + a[z_] - a[y_]) - a[n];
    if (res < sum) {
      res = sum;
      x = x_;
      y = y_;
      z = z_;
    }
  }
  cout << x << " " << y << " " << z << endl;
}
int main() {
  { main_(); }
  return 0;
}
