#include <bits/stdc++.h>
using namespace std;
int t, sum[2000005], sum2[2000005];
int main() {
  scanf("%d", &t);
  memset(sum, 0, sizeof(sum));
  int maxx = 0;
  for (int i = 1; i <= t; i++) {
    int tmp;
    scanf("%d", &tmp);
    if (tmp > maxx) maxx = tmp;
    sum[tmp]++;
  }
  int x = 1, y;
  int n, m;
  for (int i = 1; i <= maxx; i++) {
    if (sum[i] != i * 4) {
      x = i;
      break;
    }
  }
  bool flag = false;
  for (int i = 1; i <= t; i++) {
    if (t % i) continue;
    n = i;
    m = t / i;
    y = n + m - maxx - x;
    memset(sum2, 0, sizeof(sum2));
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= m; k++) {
        sum2[abs(j - x) + abs(k - y)]++;
      }
    }
    bool tmp = true;
    for (int j = 0; j <= maxx; j++) {
      if (sum[j] != sum2[j]) {
        tmp = false;
        break;
      }
    }
    if (tmp) {
      flag = true;
      break;
    }
  }
  if (!flag)
    cout << -1 << endl;
  else {
    cout << n << ' ' << m << endl;
    cout << x << ' ' << y << endl;
  }
  return 0;
}
