#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);
}
void check(long long n, long long m, long long xx, long long yy) {
  if (xx > n || yy > m || xx < 1 || yy < 1) return;
  vi v(n + m + 1);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      v[abs(i - xx + 1) + abs(j - yy + 1)]++;
      if (freq[abs(i - xx + 1) + abs(j - yy + 1)] <
          v[abs(i - xx + 1) + abs(j - yy + 1)])
        return;
    }
  cout << n << " " << m << '\n';
  cout << xx << " " << yy << '\n';
  exit(0);
}
void solve() {
  long long n, ans = 0;
  cin >> n;
  a.resize(n);
  long long ls = 0, mx = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
    freq[a[i]]++;
  }
  for (long long i = 0; i < N; i++) {
    if (freq[i] < 4 * i) {
      ls = i;
      break;
    }
  }
  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, ls, i + n / i - mx - ls);
    check(n / i, i, ls, i + n / i - mx - ls);
  }
  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;
}
