#include <bits/stdc++.h>
using namespace std;
int v;
vector<vector<int> > V;
int movx[] = {1, -1, 0, 0};
int movy[] = {0, 0, 1, -1};
int F[1000010], G[1000010];
int s, mx;
bool f(int n, int m) {
  int x, y;
  V = vector<vector<int> >(n, vector<int>(m, 0));
  x = s - 1;
  if (x >= n) return false;
  if (n - 1 - x > mx || mx - (n - 1 - x) > m) return false;
  y = m - 1 - mx + (n - 1 - x);
  if (y >= m) return false;
  queue<int> q;
  for (int i = 0; i <= mx; i++) G[i] = F[i];
  q.push(x);
  q.push(y);
  V[x][y] = 1;
  int X = x, Y = y;
  while (!q.empty()) {
    x = q.front();
    q.pop();
    y = q.front();
    q.pop();
    G[V[x][y] - 1]--;
    for (int i = 0; i < 4; i++) {
      int nx = x + movx[i], ny = y + movy[i];
      if (nx < 0 || nx >= n || ny < 0 || ny >= m) continue;
      if (V[nx][ny]) continue;
      V[nx][ny] = V[x][y] + 1;
      q.push(nx);
      q.push(ny);
    }
  }
  for (int i = 0; i <= mx; i++)
    if (G[i]) return false;
  printf("%d %d\n%d %d\n", n, m, X + 1, Y + 1);
  return true;
}
int main() {
  scanf("%d", &v);
  mx = 0;
  for (int i = 0; i < v; i++) {
    int x;
    scanf("%d", &x), F[x]++, mx = max(mx, x);
  }
  if (v == 1) {
    if (F[0] == 1)
      printf("1 1\n1 1\n");
    else
      printf("-1\n");
    return 0;
  }
  s = 0;
  for (int i = 1; i <= mx; i++) {
    if (F[i] != 4 * i) {
      s = i;
      break;
    }
  }
  for (int i = 1; i * i <= v && s; i++) {
    if (v % i) continue;
    int j = v / i;
    if (f(i, j) || f(j, i)) return 0;
  }
  printf("-1\n");
  return 0;
}
