#include <bits/stdc++.h>
using namespace std;
int total[2000005], mid[2000005];
int main() {
  int n, m, maxi, x, y, ok, mid, c, d;
  scanf("%d", &n);
  maxi = ok = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &m);
    total[m]++;
    maxi = max(maxi, m);
  }
  if (total[0] == 1) {
    if (maxi == 0) {
      ok = c = d = x = y = 1;
    } else {
      total[0] = 0;
      for (int i = 1; i <= maxi; i++) {
        if (total[i] - total[i - 1] < 4) {
          for (int j = 1; j * j <= n; j++) {
            if (n % j == 0) {
              c = j;
              d = n / j;
              ok = 1;
              x = c - i + 1;
              y = maxi - x + 2;
              for (int k = 1; k <= maxi; k++) {
                mid = k * 4;
                if (k >= x) {
                  mid -= 2 * (k - x) + 1;
                }
                if (k >= y) {
                  mid -= 2 * (k - y) + 1;
                }
                if (k > c - x) {
                  mid -= 2 * (k - c + x) - 1;
                }
                if (k > d - y) {
                  mid -= 2 * (k - d + y) - 1;
                }
                if (k - x - y + 1 > 0) {
                  mid += k - x - y + 1;
                }
                if (k - c + x - y > 0) {
                  mid += k - c + x - y;
                }
                if (k - d + y - x > 0) {
                  mid += k - d + y - x;
                }
                if (k - c - d + y + x - 1 > 0) {
                  mid += k - c - d + y + x - 1;
                }
                if (mid != total[k]) {
                  ok = 0;
                  break;
                }
              }
              if (ok) {
                break;
              }
              c = n / j;
              d = j;
              ok = 1;
              x = c - i + 1;
              y = maxi - x + 2;
              for (int k = 1; k <= maxi; k++) {
                mid = k * 4;
                if (k >= x) {
                  mid -= 2 * (k - x) + 1;
                }
                if (k >= y) {
                  mid -= 2 * (k - y) + 1;
                }
                if (k > c - x) {
                  mid -= 2 * (k - c + x) - 1;
                }
                if (k > d - y) {
                  mid -= 2 * (k - d + y) - 1;
                }
                if (k - x - y + 1 > 0) {
                  mid += k - x - y + 1;
                }
                if (k - c + x - y > 0) {
                  mid += k - c + x - y;
                }
                if (k - d + y - x > 0) {
                  mid += k - d + y - x;
                }
                if (k - c - d + y + x - 1 > 0) {
                  mid += k - c - d + y + x - 1;
                }
                if (mid != total[k]) {
                  ok = 0;
                  break;
                }
              }
              if (ok == 1) {
                break;
              }
            }
          }
          break;
        }
      }
    }
  }
  if (ok) {
    printf("%d %d\n%d %d\n", c, d, x, y);
  } else {
    printf("-1\n");
  }
  return 0;
}
