#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using vi = vector<long long>;
using mi = map<long long, long long>;
using pi = pair<long long, long long>;
const long long N = 1000005;
const long long MOD = 1e9 + 7;
const long long inf = 1e18 + 1;
vi a;
long long freq[N];
long long sum = 0;
long long zero = -1;
void NO() {
  cout << -1 << '\n';
  exit(0);
}
vector<ld> findRoots(long long a, long long b, long long c) {
  vector<ld> ans;
  if (a == 0) {
    ans.push_back(-1);
    return ans;
  }
  long long d = b * b - 4 * a * c;
  ld sqrt_val = sqrtl(abs(d));
  if (d > 0) {
    if (((ld)(-b + sqrt_val) / (2 * a)) >= 0)
      ans.push_back((ld)(-b + sqrt_val) / (2 * a));
    if (((ld)(-b - sqrt_val) / (2 * a)) >= 0)
      ans.push_back((ld)(-b - sqrt_val) / (2 * a));
    if (ans.size() == 0) ans.push_back(-1);
  } else if (d == 0) {
    if ((-(ld)b / (2 * a)) >= 0)
      ans.push_back(-(ld)b / (2 * a));
    else
      ans.push_back(-1);
  } else {
    ans.push_back(-1);
  }
  return ans;
}
void check(long long n, long long m) {
  long long xx = -1, yy = -1;
  for (long long i = 0; i < n; i++) {
    long long t = sum - m * ((i * (i + 1)) / 2 + ((n - 1 - i) * (n - i)) / 2);
    t *= 2;
    vector<ld> jj = findRoots(2 * n, (2 - 2 * m) * n, n * (m * m - m) - t);
    if (jj[0] == -1) continue;
    for (ld x : jj) {
      if (abs(x - (long long)(x)) <= 1e-5) {
        if ((long long)(x) >= m) continue;
        yy = (long long)(x);
        xx = i;
        vi v(N);
        for (long long i = 0; i < n; i++)
          for (long long j = 0; j < m; j++) {
            v[abs(i - xx) + abs(j - yy)]++;
            if (freq[abs(i - xx) + abs(j - yy)] < v[abs(i - xx) + abs(j - yy)])
              goto end;
          }
        cout << n << " " << m << '\n';
        cout << xx + 1 << " " << yy + 1 << '\n';
        exit(0);
      end:;
      }
    }
  }
}
void solve() {
  long long n, ans = 0;
  cin >> n;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    freq[a[i]]++;
  }
  if (freq[0] == 0) {
    NO();
  }
  if (n == 1) {
    cout << "1 1\n1 1" << '\n';
    return;
  }
  for (long long i = 1; i * i <= n; i++) {
    if (n % i) continue;
    check(i, n / i);
  }
  cout << -1 << '\n';
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
