#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int _w;
int n, cnt[N], mx, bound;
int dis(int a, int b, int c, int d) { return abs(a - c) + abs(b - d); }
int dc(int r, int c, int x, int y) {
  int d = 0;
  d = max(d, dis(1, 1, x, y));
  d = max(d, dis(1, c, x, y));
  d = max(d, dis(r, 1, x, y));
  d = max(d, dis(r, c, x, y));
  return d;
}
int tmp[N];
void add(int y, int v, int c) {
  ++tmp[v], --tmp[v + 1];
  if (y != 1) ++tmp[v + 1], --tmp[v + y];
  if (y != c) ++tmp[v + 1], --tmp[v + c - y + 1];
}
void check(int r, int c, int x, int y) {
  if (x < 1 || y < 1 || x > r || y > c) return;
  if (dc(r, c, x, y) != mx) return;
  for (int i = 0; i <= mx; ++i) tmp[i] = 0;
  add(y, 0, c);
  for (int i = 1; x - i >= 1; ++i) add(y, i, c);
  for (int i = 1; x + i <= r; ++i) add(y, i, c);
  for (int i = 1; i <= mx; ++i) tmp[i] += tmp[i - 1];
  bool flag = true;
  for (int i = 0; i <= mx; ++i)
    if (tmp[i] != cnt[i]) {
      flag = false;
      break;
    }
  if (flag) {
    printf("%d %d\n", r, c);
    printf("%d %d\n", x, y);
    exit(0);
  }
}
void solve(int r, int c) {
  for (int i = 1; i <= c; ++i) {
    check(r, c, bound, i);
    check(r, c, r - bound + 1, i);
  }
  for (int i = 1; i <= r; ++i) {
    check(r, c, i, bound);
    check(r, c, i, c - bound + 1);
  }
}
int main() {
  _w = scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    _w = scanf("%d", &x);
    ++cnt[x];
    mx = max(mx, x);
  }
  if (cnt[0] != 1) return puts("-1"), 0;
  for (int i = 1;; ++i)
    if (cnt[i] != i * 4) {
      bound = i;
      break;
    }
  for (int i = 1; i * i <= n; ++i)
    if (n % i == 0) {
      int j = n / i;
      solve(i, j);
    }
  return puts("-1"), 0;
}
