#include <bits/stdc++.h>
using namespace std;
long long qpow(long long x, int y) {
  long long res = 1;
  for (; y > 0; y >>= 1, x = x * x % 1000000007) {
    if (y & 1) res = (res * x) % 1000000007;
  }
  return res;
}
int q[2000003];
int c[2000003];
int v[2000003];
inline int chk(int n, int m, int x, int y) {
  memset(v, 0, sizeof(v));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int d = abs(x - i) + abs(y - j);
      ++v[d];
    }
  }
  for (int i = 0; i < n * m; i++)
    if (c[i] != v[i]) return 0;
  return 1;
}
int main() {
  int Tn = 1;
  for (int ci = 1; ci <= Tn; ++ci) {
    int n;
    cin >> n;
    int mx = 0;
    memset(c, 0, sizeof(c));
    for (int i = 0; i < n; ++i) {
      scanf("%d", q + i);
      ++c[q[i]];
      if (mx < q[i]) mx = q[i];
    }
    int flag = 1;
    int X = -1, Y = -1;
    int N = -1, M = -1;
    for (int i = 1; i <= n && flag; ++i) {
      int k = i * 4;
      if (c[i] > k) {
        flag = 0;
        break;
      }
      if (c[i] < k) {
        X = i - 1;
        break;
      }
    }
    if (flag)
      for (Y = 0; Y < n; ++Y) {
        if ((Y + 1) * (X + 1) > n) break;
        int S = mx + 2 + (X + Y);
        long long z = (long long)S * S - 4 * n;
        if ((long long)sqrt(z) * sqrt(z) == z) {
          int B = sqrt(z);
          if ((S - B) % 2 == 0) {
            N = S - B >> 1;
            M = S - N;
            if (Y + M - 1 - X <= mx && chk(M, N, X, Y)) {
              cout << M << " " << N << endl;
              cout << X + 1 << " " << Y + 1 << endl;
              return 0;
            }
            if (Y + N - 1 - X <= mx && chk(N, M, X, Y)) {
              cout << N << " " << M << endl;
              cout << X + 1 << " " << Y + 1 << endl;
              return 0;
            }
          }
        }
        N = mx + X + 1 - Y;
        if (N > X && n % N == 0) {
          M = n % N;
          if (M > Y && N - 1 - X + M - 1 - Y <= mx) {
            if (chk(N, M, X, Y)) {
              cout << M << " " << N << endl;
              cout << X + 1 << " " << Y + 1 << endl;
              return 0;
            }
          }
        }
      }
    cout << -1 << endl;
  }
  return 0;
}
