#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(30);
  int t;
  cin >> t;
  vector<int> a(t);
  for (int &i : a) cin >> i;
  int p = -1;
  for (int i : a) p = max(i, p);
  vector<int> cnt(t + 10);
  for (int i : a) cnt[i]++;
  int q = -1, r = -1;
  int exp = 4;
  int now = 0;
  for (int i = 1; i < t + 10; i++) {
    if (now == 0) {
      if (exp > cnt[i] && now == 0) {
        q = i - 1;
        exp -= 1;
        now = 1;
      } else {
        exp += 4;
      }
    }
    if (now == 1) {
      if (exp > cnt[i] && now == 1) {
        r = i - 1;
        break;
      } else {
        exp += 2;
      }
    }
  }
  vector<pair<int, int> > ns;
  for (int i = 0; i <= p; i++) {
    if ((i + q + 1) * (p - i + r + 1) == t) ns.push_back({i, p - i});
  }
  int n, m;
  for (int zz = 0; zz < ns.size(); zz++) {
    int a, b;
    tie(a, b) = ns[zz];
    n = a + q + 1;
    if (t % n != 0) continue;
    m = t / n;
    int x = q, y = r;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cnt[abs(x - i) + abs(y - j)]--;
      }
    }
    bool f = 1;
    for (int i : cnt) {
      if (i != 0) {
        f = 0;
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cnt[abs(x - i) + abs(y - j)]++;
      }
    }
    if (f) {
      cout << n << ' ' << m << '\n' << x + 1 << ' ' << y + 1 << endl;
      return 0;
    }
  }
  n = r + q + 1;
  if (t % n == 0) {
    m = t / n;
    int x = max(r, q), y = p - max(r, q);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cnt[abs(x - i) + abs(y - j)]--;
      }
    }
    bool f = 1;
    for (int i : cnt) {
      if (i != 0) {
        f = 0;
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cnt[abs(x - i) + abs(y - j)]++;
      }
    }
    if (f) {
      cout << n << ' ' << m << '\n' << x + 1 << ' ' << y + 1 << endl;
      return 0;
    }
  }
  cout << -1;
  return 0;
}
