#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int N = 1e6 + 10;
int a[N], dp[N];
int main() {
  int t;
  int maxn = -1;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    int x;
    scanf("%d", &x);
    maxn = max(x, maxn);
    a[x]++;
  }
  if (t == 1 && maxn == 0) {
    printf("1 1\n1 1");
    return 0;
  }
  int ansx, ansy;
  int k = 0;
  for (int i = 1; i <= maxn; i++) {
    if (a[i] != 4 * i) {
      ansx = i;
      break;
    }
  }
  int n, m;
  for (int p = 1; p <= t; p++) {
    if (t % p) continue;
    n = p, m = t / p;
    ansy = n + m - maxn - ansx;
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) dp[abs(i - ansx) + abs(j - ansy)]++;
    for (int j = 0; j <= maxn; j++)
      if (a[j] != dp[j]) goto eg;
    k = 1;
  eg:;
    if (k) break;
  }
  if (k)
    printf("%d %d\n%d %d\n", n, m, ansx, ansy);
  else
    printf("-1\n");
  return 0;
}
