#include <bits/stdc++.h>
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
using namespace std;
const int mod = 998244353;
const int mxn = 1e6 + 7;
const int inf = 1e9;
int _, n, m, t, k, u, v, w, ans, cnt, ok, lim, len, tmp, last;
struct node {
  int u, v;
} e[mxn];
int a[mxn], vis[mxn];
void solve() {
  if (vis[0] != 1) {
    cout << -1 << endl;
    return;
  }
  int l, r, x = 1, y;
  ok = 1;
  for (int i = 1; i <= n; i++) {
    if (vis[i] > 4 * i) {
      cout << -1 << endl;
      return;
    }
    if (vis[i] < 4 * i) {
      x = i;
      break;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (n % i) continue;
    m = n / i;
    y = i - x + m - last;
    memset(a, 0, sizeof(a));
    for (int j = 1; j <= i; j++) {
      for (int k = 1; k <= m; k++) {
        tmp = abs(j - x) + abs(k - y);
        a[tmp]++;
      }
    }
    int flag = 1;
    for (int j = 1; j <= n; j++) {
      if (a[j] != vis[j]) {
        flag = 0;
        break;
      }
    }
    if (flag) {
      cout << i << " " << m << endl << x << " " << y << endl;
      ok = 0;
      break;
    }
  }
  if (ok) cout << -1 << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  while (cin >> n) {
    memset(vis, 0, sizeof(vis));
    last = 0;
    for (int i = 1; i <= n; i++) {
      cin >> k, vis[k]++;
      last = max(last, k);
    }
    solve();
  }
}
