#include <bits/stdc++.h>
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
long long t, v[1000005], c[1000005], max, n, m, x, y, a, b;
long long app[1000005];
bool check() {
  memset(app, 0, sizeof(app));
  for (long long i = 0; i != n; ++i)
    for (long long j = 0; j != m; ++j) ++app[llabs(i - x) + llabs(j - y)];
  for (long long i = 0; i != t; ++i)
    if (app[i] != c[i]) return false;
  return true;
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin >> t;
  for (long long i = 0; i != t; ++i) {
    std::cin >> v[i];
    ++c[v[i]];
    max = std::max(max, v[i]);
  }
  for (long long i = 1; i <= t; ++i)
    if (c[i] != i * 4) {
      x = i - 1;
      break;
    }
  b = max;
  for (long long i = 1; i <= t; ++i) {
    if (t % i == 0) {
      n = i;
      m = t / i;
      y = n + m - x - b - 2;
      a = x + y;
      if (check()) {
        std::cout << n << ' ' << m << std::endl
                  << x + 1 << ' ' << y + 1 << std::endl;
        return 0;
      }
    }
  }
  std::cout << -1 << std::endl;
  return 0;
}
