#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 1e6 + 5;
const int MOD = 1e9 + 7;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
long long pw(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int n, mx, ax, ay, c[MAXN], cc[MAXN];
int dir[][2] = {1, 0, -1, 0, 0, 1, 0, -1};
void gao(int R, int C) {
  ay = R + C - ax - mx;
  if (ay < 1 || ay > C) return;
  for (int i = 0; i < n; i++) cc[i] = 0;
  for (int i = 1; i <= R; i++)
    for (int j = 1; j <= C; j++) cc[abs(i - ax) + abs(j - ay)]++;
  for (int i = 0; i < n; i++)
    if (c[i] != cc[i]) return;
  printf("%d %d\n%d %d\n", R, C, ax, ay);
  exit(0);
}
int main() {
  scanf("%d", &n);
  mx = -1;
  for (int i = 1, x; i <= n; i++) scanf("%d", &x), c[x]++, mx = max(mx, x);
  if (c[0] != 1) {
    puts("-1");
    exit(0);
  }
  ax = 1;
  while (c[ax] == ax * 4) ax++;
  for (int i = 1; i * i <= n; i++)
    if (n % i == 0) gao(i, n / i), gao(n / i, i);
  puts("-1");
}
