#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<int> cnt(t, 0);
  for (int i = 0; i < t; i++) {
    int a;
    scanf("%d", &a);
    cnt[a]++;
  }
  if (cnt[0] != 1) {
    cout << "-1\n";
    return 0;
  }
  if (t == 1) {
    cout << "1 1\n1 1\n";
    return 0;
  }
  int i = 1, n, m, x, y;
  while (cnt[i] == i * 4) i++;
  x = i;
  while (cnt[i] == i * 4 - (i - x) * 2 - 1) i++;
  m = x + i - 1;
  n = t / m;
  int j = i;
  if (cnt[j] > cnt[j - 1]) {
    j++;
    while (cnt[j] == cnt[j - 1]) j++;
  }
  y = j;
  vector<int> cnt2(t * 2, 0);
  for (int a = 1; a <= m; a++) {
    for (int b = 1; b <= n; b++) {
      cnt2[abs(a - x) + abs(b - y)]++;
    }
  }
  bool b1 = true;
  for (int a = 1; a < t; a++) {
    if (cnt[a] != cnt2[a]) {
      b1 = false;
      break;
    }
  }
  if (b1) {
    cout << m << " " << n << endl << x << " " << y << endl;
    return 0;
  }
  y = i;
  fill(cnt2.begin(), cnt2.end(), 0);
  for (j = 1; j < t; j++) {
    for (int a = 1; a < j; a++) cnt2[abs(a - x) + abs(j - x)]++;
    for (int a = 1; a <= j + y - x; a++) cnt2[abs(j - x) + abs(a - y)]++;
    if (j > x && cnt[j - x] != cnt2[j - x]) {
      n = j - 1 + y - x;
      m = t / n;
      fill(cnt2.begin(), cnt2.end(), 0);
      for (int a = 1; a <= m; a++) {
        for (int b = 1; b <= n; b++) {
          cnt2[abs(a - x) + abs(b - y)]++;
        }
      }
      b1 = true;
      for (int a = 1; a < t; a++) {
        if (cnt[a] != cnt2[a]) {
          b1 = false;
          break;
        }
      }
      if (b1) {
        cout << m << " " << n << endl << x << " " << y << endl;
        return 0;
      }
      m = j - 1;
      n = t / m;
      fill(cnt2.begin(), cnt2.end(), 0);
      for (int a = 1; a <= m; a++) {
        for (int b = 1; b <= n; b++) {
          cnt2[abs(a - x) + abs(b - y)]++;
        }
      }
      for (int a = 1; a < t; a++) {
        if (cnt[a] != cnt2[a]) {
          cout << "-1\n";
          return 0;
        }
      }
      cout << m << " " << n << endl << x << " " << y << endl;
      return 0;
    }
  }
  return 0;
}
