#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
int t, a[maxn], n, m, x, y, c[maxn];
int cc[maxn];
int main() {
  cin >> t;
  int mx = 0;
  for (int i = 0; i < t; ++i) {
    cin >> a[i];
    c[a[i]]++;
    mx = max(mx, a[i]);
  }
  int l1, l2;
  int i;
  for (i = 1; i <= mx; ++i) {
    if (c[i] != 4 * i) break;
  }
  l1 = i - 1;
  int lack;
  for (lack = 1; i <= mx; ++i, lack += 2) {
    if (i * 4 - lack != c[i]) break;
  }
  l2 = i - 1;
  x = l1, y = l2;
  for (int n = 1; 2 * n <= t; ++n) {
    if (t % n != 0) continue;
    m = t / n;
    if (n - 1 >= x && m - 1 >= y) {
      memset(cc, 0, sizeof(cc));
      int mxc = 0;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          cc[abs(i - x) + abs(j - y)]++;
          mxc = max(mxc, abs(i - x) + abs(j - y));
        }
      }
      if (mxc == mx) {
        bool flag = 1;
        for (int i = 0; i < mx; ++i) {
          if (cc[i] != c[i]) {
            flag = 0;
            break;
          }
        }
        if (flag) {
          cout << n << " " << m << endl;
          cout << x + 1 << " " << y + 1 << endl;
          return 0;
        }
      }
    }
  }
  x = l1, n = l1 + l2 + 1;
  if (t % n == 0) {
    m = t / n;
    for (y = 0; y < m; ++y) {
      if (max(abs(0 - x) + abs(0 - y),
              max(abs(0 - x) + abs(m - 1 - y),
                  max(abs(n - 1 - x) + abs(0 - y),
                      abs(n - 1 - x) + abs(m - 1 - y)))) != mx)
        continue;
      memset(cc, 0, sizeof(cc));
      int mxc = 0;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          cc[abs(i - x) + abs(j - y)]++;
          mxc = max(mxc, abs(i - x) + abs(j - y));
        }
      }
      if (mxc == mx) {
        bool flag = 1;
        for (int i = 0; i < mx; ++i) {
          if (cc[i] != c[i]) {
            flag = 0;
            break;
          }
        }
        if (flag) {
          cout << n << " " << m << endl;
          cout << x + 1 << " " << y + 1 << endl;
          return 0;
        }
      }
    }
  }
  cout << "-1" << endl;
  return 0;
}
