Problem:
Score : 700 points

Problem Statement

Aoki loves numerical sequences and trees.

One day, Takahashi gave him an integer sequence of length N, a_1, a_2, ..., a_N, which made him want to construct a tree.

Aoki wants to construct a tree with N vertices numbered 1 through N, such that for each i = 1,2,...,N, the distance between vertex i and the farthest vertex from it is a_i, assuming that the length of each edge is 1.

Determine whether such a tree exists.

Constraints

2 ≦ N ≦ 100

1 ≦ a_i ≦ N-1

Input

The input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

If there exists a tree that satisfies the condition, print Possible. Otherwise, print Impossible.

Sample Input 1

5
3 2 2 3 3

Sample Output 1

Possible

The diagram above shows an example of a tree that satisfies the conditions. The red arrows show paths from each vertex to the farthest vertex from it.

Sample Input 2

3
1 1 2

Sample Output 2

Impossible

Sample Input 3

10
1 2 2 2 2 2 2 2 2 2

Sample Output 3

Possible

Sample Input 4

10
1 1 2 2 2 2 2 2 2 2

Sample Output 4

Impossible

Sample Input 5

6
1 1 1 1 1 5

Sample Output 5

Impossible

Sample Input 6

5
4 3 2 3 4

Sample Output 6

Possible

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    //N=100;
    vl X(N);
    vl cnt(102,0);
    rep(i,N){
        cin >> X[i];
        //X[i]=(i<2?99:100);
        cnt[X[i]]++;
    }
    ll i=1;
    while(cnt[i]==0){
        i++;
    }
    if(i==1){
        if(cnt[1]==1&&cnt[2]==N-1){
            cout << "Possible" << endl;
        }
        else{
            cout << "Impossible" << endl;
        }
        return 0;
    }
    else{
        if(cnt[i]>2){
            cout << "Impossible" << endl;
        }
        else{
            ll now=cnt[i];
            ll j=i;
            i++;
            while(cnt[i]>=2){
                now+=cnt[i];
                i++;
            }
            if(!((cnt[j]==1&&i%2==0)||(cnt[j]==2&&i%2==1))){
                cout << "Impossible" << endl;
                return 0;
            }
            if(!(i==2*j+2||i==2*j+1)){
                cout << "Impossible" << endl;
            }
            else if(now==N){
                cout << "Possible" << endl;
            }
            else{
                cout << "Impossible" << endl;
            }
        }
        return 0;
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/