#include <bits/stdc++.h>
using namespace std;
const int dr[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
int ar[1000001] = {}, tp[1000001] = {}, x, t, sm1 = -1, sm2 = -1, lg, an, am,
    ay, ax;
vector<vector<bool> > v;
queue<pair<pair<int, int>, int> > q;
inline bool ck2(int n, int m, int y, int x) {
  return y >= 0 && y < n && x >= 0 && x < m;
}
inline bool ck(int n, int m, int y, int x) {
  bool bb = 1;
  for (int i = 0; i < n; i++) {
    v.push_back(vector<bool>());
    for (int j = 0; j < m; j++) {
      v[i].push_back(0);
    }
  }
  q.push({{y, x}, 0});
  while (!q.empty()) {
    pair<pair<int, int>, int> tpp = q.front();
    q.pop();
    if (!v[tpp.first.first][tpp.first.second]) {
      v[tpp.first.first][tpp.first.second] = 1;
      tp[tpp.second]++;
      for (int i = 0; i < 4; i++) {
        if (ck2(n, m, tpp.first.first + dr[i][0],
                tpp.first.second + dr[i][1])) {
          q.push({{tpp.first.first + dr[i][0], tpp.first.second + dr[i][1]},
                  tpp.second + 1});
        }
      }
    }
  }
  for (int i = 0; i < t; i++) {
    bb &= (ar[i] == tp[i]);
    tp[i] = 0;
  }
  v.clear();
  return bb;
}
int main() {
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%d", &x);
    ar[x]++;
    lg = max(lg, x);
  }
  if (t == 1) {
    printf("1 1\n1 1\n");
  } else {
    for (int i = 1; i < t; i++) {
      if (ar[i] < 4 * i) {
        sm1 = i - 1;
        break;
      }
    }
    for (int i = sm1 + 1; i < t; i++) {
      if (ar[i] < 4 * i - 2 * (i - sm1 - 1) - 1) {
        sm2 = i - 1;
        break;
      }
    }
    for (int i = 1; i * i <= t; i++) {
      if (t % i == 0) {
        if (t / i + i == sm1 + sm2 + lg + 2) {
          if (sm1 < i && sm2 < t / i) {
            if (ck(i, t / i, sm1, sm2)) {
              an = i;
              am = t / i;
              ay = sm1;
              ax = sm2;
            }
          }
          if (sm1 < t / i && sm2 < i) {
            if (ck(t / i, i, sm1, sm2)) {
              an = t / i;
              am = i;
              ay = sm1;
              ax = sm2;
            }
          }
          break;
        }
      }
    }
    if (t % (sm1 + sm2 + 1) == 0) {
      if (ck(sm1 + sm2 + 1, t / (sm1 + sm2 + 1), max(sm1, sm2),
             lg - max(sm1, sm2))) {
        an = sm1 + sm2 + 1;
        am = t / (sm1 + sm2 + 1);
        ay = max(sm1, sm2);
        ax = lg - max(sm1, sm2);
      }
    }
    if (an) {
      printf("%d %d\n %d %d\n", an, am, ay + 1, ax + 1);
    } else {
      printf("-1\n");
    }
  }
  return 0;
}
