Bob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if a is a friend of b, then b is also a friend of a. Each user thus has a non-negative amount of friends.

This morning, somebody anonymously sent Bob the following link: [graph realization problem](https://en.wikipedia.org/wiki/Graph_realization_problem) and Bob wants to know who that was. In order to do that, he first needs to know how the social network looks like. He investigated the profile of every other person on the network and noted down the number of his friends. However, he neglected to note down the number of his friends. Help him find out how many friends he has. Since there may be many possible answers, print all of them.

Input

The first line contains one integer n (1 ≤ n ≤ 5 ⋅ 10^5), the number of people on the network excluding Bob. 

The second line contains n numbers a_1,a_2, ..., a_n (0 ≤ a_i ≤ n), with a_i being the number of people that person i is a friend of.

Output

Print all possible values of a_{n+1} — the amount of people that Bob can be friend of, in increasing order.

If no solution exists, output -1.

Examples

Input

3
3 3 3


Output

3 


Input

4
1 1 1 1


Output

0 2 4 


Input

2
0 2


Output

-1


Input

35
21 26 18 4 28 2 15 13 16 25 6 32 11 5 31 17 9 3 24 33 14 27 29 1 20 4 12 7 10 30 34 8 19 23 22


Output

13 15 17 19 21 

Note

In the first test case, the only solution is that everyone is friends with everyone. That is why Bob should have 3 friends.

In the second test case, there are three possible solutions (apart from symmetries): 

  * a is friend of b, c is friend of d, and Bob has no friends, or 
  * a is a friend of b and both c and d are friends with Bob, or 
  * Bob is friends of everyone. 



The third case is impossible to solve, as the second person needs to be a friend with everybody, but the first one is a complete stranger.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <typename...>
static inline int getchar_unlocked(void) {
  return getchar();
}
template <typename...>
static inline void putchar_unlocked(int c) {
  putchar(c);
}
void reader(int& x) {
  int k, m = 0;
  x = 0;
  for (;;) {
    (k) = getchar_unlocked();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    (k) = getchar_unlocked();
    if (k < '0' || k > '9') break;
    x = x * 10 + k - '0';
  }
  if (m) x = -x;
}
void reader(ll& x) {
  int k, m = 0;
  x = 0;
  for (;;) {
    (k) = getchar_unlocked();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    (k) = getchar_unlocked();
    if (k < '0' || k > '9') break;
    x = x * 10 + k - '0';
  }
  if (m) x = -x;
}
int reader(char c[]) {
  int i, s = 0;
  for (;;) {
    (i) = getchar_unlocked();
    if (i != ' ' && i != '\n' && i != '\r' && i != '\t' && i != EOF) break;
  }
  c[s++] = i;
  for (;;) {
    (i) = getchar_unlocked();
    if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break;
    c[s++] = i;
  }
  c[s] = '\0';
  return s;
}
int reader(string& c) {
  int i;
  for (;;) {
    (i) = getchar_unlocked();
    if (i != ' ' && i != '\n' && i != '\r' && i != '\t' && i != EOF) break;
  }
  c.push_back(i);
  for (;;) {
    (i) = getchar_unlocked();
    if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break;
    c.push_back(i);
  };
  return ((int)c.size());
}
template <class T, class S>
void reader(T& x, S& y) {
  reader(x);
  reader(y);
}
template <class T, class S, class U>
void reader(T& x, S& y, U& z) {
  reader(x);
  reader(y);
  reader(z);
}
template <class T, class S, class U, class V>
void reader(T& x, S& y, U& z, V& w) {
  reader(x);
  reader(y);
  reader(z);
  reader(w);
}
void writer(int x, char c) {
  int s = 0, m = 0;
  char f[10];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) putchar_unlocked('-');
  while (s--) putchar_unlocked(f[s] + '0');
  putchar_unlocked(c);
}
void writer(ll x, char c) {
  int s = 0, m = 0;
  char f[20];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) putchar_unlocked('-');
  while (s--) putchar_unlocked(f[s] + '0');
  putchar_unlocked(c);
}
void writer(const char c[]) {
  int i;
  for (i = 0; c[i] != '\0'; i++) putchar_unlocked(c[i]);
}
void writer(const string& x, char c) {
  int i;
  for (i = 0; x[i] != '\0'; i++) putchar_unlocked(x[i]);
  putchar_unlocked(c);
}
void writer(const char x[], char c) {
  int i;
  for (i = 0; x[i] != '\0'; i++) putchar_unlocked(x[i]);
  putchar_unlocked(c);
}
template <class T>
void writerLn(T x) {
  writer(x, '\n');
}
template <class T, class S>
void writerLn(T x, S y) {
  writer(x, ' ');
  writer(y, '\n');
}
template <class T, class S, class U>
void writerLn(T x, S y, U z) {
  writer(x, ' ');
  writer(y, ' ');
  writer(z, '\n');
}
template <class T, class S, class U, class V>
void writerLn(T x, S y, U z, V v) {
  writer(x, ' ');
  writer(y, ' ');
  writer(z, ' ');
  writer(v, '\n');
}
template <class T>
void writerArr(T x[], int n) {
  if (!n) {
    putchar_unlocked('\n');
    return;
  }
  for (int i = 0; i < (n - 1); i++) writer(x[i], ' ');
  writer(x[n - 1], '\n');
}
template <class T>
void writerArr(vector<T>& x) {
  writerArr(x.data(), (int)x.size());
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
ll mod_pow(ll a, ll n, ll mod) {
  ll ret = 1;
  ll p = a % mod;
  while (n) {
    if (n & 1) ret = ret * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return ret;
}
template <class T>
T extgcd(T a, T b, T& x, T& y) {
  for (T u = y = 1, v = x = 0; a;) {
    T q = b / a;
    swap(x -= q * u, u);
    swap(y -= q * v, v);
    swap(b -= q * a, a);
  }
  return b;
}
ll mod_inv(ll a, ll m) {
  ll x, y;
  extgcd<ll>(a, m, x, y);
  return (m + x % m) % m;
}
bool gfp(vector<long long> x) {
  sort(x.begin(), x.end());
  while (((long long)x.size())) {
    long long p = x.back();
    if (p == 0) break;
    x.pop_back();
    for (long long i = 0; i < (p); i++) {
      if (x[((long long)x.size()) - 1 - i]-- == 0) {
        return false;
      }
    }
    sort(x.begin(), x.end());
  }
  return true;
}
vector<long long> naive(vector<long long> a) {
  const long long n = ((long long)a.size());
  a.push_back(0);
  vector<long long> xx;
  for (long long i = 0; i < (n + 1); i++) {
    a[n] = i;
    bool ans = gfp(a);
    if (ans) xx.push_back(i);
  }
  return xx;
}
vector<long long> solve(vector<long long> a) {
  sort(a.rbegin(), a.rend());
  const long long n = ((long long)a.size());
  vector<ll> sa(n + 1);
  for (long long i = 0; i < (n); i++) sa[i + 1] = sa[i] + a[i];
  vector<vector<ll>> erdosGallai;
  for (long long k = 0; k < (2); k++) {
    vector<ll> cans;
    vector<ll> q;
    ll qsum = 0;
    for (long long i = ((long long)a.size()) - 1; i >= 0; i--) {
      long long ci = i;
      if (k) ci++;
      while (((long long)q.size()) && q.back() >= ci + 1) {
        qsum -= q.back();
        q.pop_back();
      }
      long long upperCount = ((long long)a.size()) - 1 - i;
      ll exceeds = ll(upperCount - ((long long)q.size())) * (ci + 1);
      ll cval = ci * (ci + 1) + qsum + exceeds - sa[i + 1];
      qsum += a[i];
      q.push_back(a[i]);
      cans.push_back(cval);
    }
    reverse(cans.begin(), cans.end());
    erdosGallai.push_back(cans);
  }
  multiset<ll> upperBounds;
  for (long long i = 0; i < (n); i++) upperBounds.insert(erdosGallai[1][i]);
  bool possibleLowerBound = true;
  ll cLowerBound = 0;
  vector<long long> ans;
  long long bobId = 0;
  for (long long bob = n; bob >= 0; bob--) {
    if ((sa.back() + bob) % 2 != 0) continue;
    while (bobId < n && bob < a[bobId]) {
      upperBounds.erase(upperBounds.find(erdosGallai[1][bobId]));
      ll ccLB = -erdosGallai[0][bobId];
      if (ccLB > 0) {
        long long threshould = bobId + 1;
        if (ccLB > threshould) {
          possibleLowerBound = false;
        }
        cLowerBound = max(cLowerBound, ccLB);
      }
      bobId++;
    }
    bool ok = possibleLowerBound;
    if (((long long)upperBounds.size())) {
      if (bob > *upperBounds.begin()) {
        ok = false;
      }
    }
    if (bob < cLowerBound) {
      ok = false;
    }
    if (bobId != n) {
      ll cc = erdosGallai[0][bobId] + a[bobId] + min(bobId + 1, a[bobId]);
      if (bob > cc) {
        ok = false;
      }
    }
    if (ok) {
      ans.push_back(bob);
    }
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
void test(long long n) {
  long long x = 1;
  for (long long i = 0; i < (n); i++) x *= n + 1;
  for (long long i = 0; i < (x); i++) {
    vector<long long> a;
    long long y = i;
    for (long long j = 0; j < (n); j++) {
      a.push_back(y % (n + 1));
      y /= n + 1;
    }
    auto a1 = solve(a);
    auto a2 = naive(a);
    if (a1 != a2) {
      cout << "?";
    }
  }
}
signed main() {
  long long n;
  reader(n);
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) reader(a[i]);
  auto ans = solve(a);
  if (((long long)ans.size())) {
    writerArr(ans);
  } else {
    writerLn(-1);
  }
  return 0;
}
