#include <bits/stdc++.h>
using namespace std;
long t, n, m, x, y, b;
long f[1000001], a[1000001];
bool check(long x, long y, long n, long m) {
  if (x > n || y > m) return 0;
  memset(f, 0, sizeof(f));
  for (long i = 1; i <= n; i++)
    for (long j = 1; j <= m; j++) {
      f[abs(i - x) + abs(j - y)]++;
    }
  for (long i = 1; i <= t; i++) {
    if (f[i] != a[i]) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  for (long i = 1; i <= t; i++) {
    cin >> x;
    b = max(b, x);
    a[x]++;
  }
  for (long i = 1; i <= t; i++) {
    if (a[i] != 4 * i) {
      x = i;
      break;
    }
  }
  for (long n = 1; n <= t; n++) {
    if (t % n == 0) {
      m = t / n;
      y = m + n - b - x;
      if (check(x, y, n, m)) {
        cout << n << " " << m << "\n";
        cout << x << " " << y;
        return 0;
      }
    }
  }
  cout << -1;
  return 0;
}
