#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 5;
long long b[maxn];
long long c[maxn];
long long h[maxn];
void check(long long x, long long y, long long n, long long m) {
  if (x < 0 || y < 0 || x > n || y > m) return;
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      c[abs(x - i) + abs(y - j)]++;
    }
  }
  for (long long i = 0; i <= (n * m); ++i) {
    if (c[i] != b[i]) {
      for (long long j = 0; j <= (n * m); ++j) {
        c[j] = 0;
      }
      return;
    }
  }
  cout << n << ' ' << m << endl;
  cout << x + 1 << ' ' << y + 1 << endl;
  exit(0);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    b[a[i]]++;
  }
  for (long long i = 1; i * i <= n; ++i) {
    long long j = (n / i);
    if ((i * j) != n) continue;
    long long rc;
    for (long long i = 1; i < maxn; ++i) {
      if (b[i] != 4 * i) {
        rc = (i - 1);
        break;
      }
    }
    long long d;
    for (long long i1 = (maxn - 1); i1 >= 0; i1--) {
      if (b[i1]) {
        d = (i + j - 2 - i1);
        break;
      }
    }
    long long x1 = rc;
    long long y1 = d - rc;
    check(x1, y1, i, j);
    long long x2 = d - rc;
    long long y2 = rc;
    check(x2, y2, i, j);
  }
  cout << (-1);
  return 0;
}
