#include <bits/stdc++.h>
using namespace std;
int need(int i, int a, int d) {
  return max(i + 1 - max(i - a, 0) - max(i - d, 0), 0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  int mx = 0;
  for (int i = 0; i < (int)n; i++) {
    cin >> v[i];
    mx = max(mx, v[i]);
  }
  if (mx == 0 && n != 1) {
    cout << "-1\n";
    return 0;
  }
  vector<int> freq(mx + 1);
  for (int i = 0; i < (int)n; i++) freq[v[i]]++;
  int sq = sqrt(n);
  if (freq[mx] == 1 || freq[mx] == 2 || freq[mx] == 4) {
    for (int f1 = 1; f1 <= sq; f1++) {
      if (n % f1 != 0) continue;
      int f2 = n / f1;
      for (int d = max(mx - f1 + 1, 0); d <= f2 - 1; d++) {
        int a = mx - d, b = f1 - a - 1, c = f2 - d - 1;
        if (a < 0) break;
        bool bad = 0;
        for (int i = 1; !bad && i <= mx; i++)
          if (freq[i] != need(i, a, d) + need(i, b, d) + need(i, a, c) +
                             need(i, b, c) - (i <= a) - (i <= d) - (i <= b) -
                             (i <= c))
            bad = 1;
        if (bad) continue;
        cout << f1 << " " << f2 << "\n";
        cout << b + 1 << " " << c + 1 << "\n";
        return 0;
      }
    }
    cout << "-1\n";
  } else
    cout << "-1\n";
}
