#include <bits/stdc++.h>
using namespace std;

#define maxn 200002
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 __y0
#define y1 __y1
#define x0 __x0
#define x1 __x1
#define next __next
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int n, d[maxn], p[maxn], grundy[maxn], tmp[maxn];
vector<int> a[maxn], q;
priority_queue<ii, vector<ii>, greater<ii> > pq;

ii MEX(int u) {
    q.clear();
    REP(i, a[u].sz()) {
        if (grundy[a[u][i]]!=-1)
            q.push_back(grundy[a[u][i]]);
    }
    ii res;
    q.push_back(inf);
    sort(q.begin(), q.end());
    REP(i, q.sz()) {
        if (i==0 && q[i]>0) {
            res.fi = 0;
            break;
        }
        if (i!=0 && q[i]>q[i-1]+1) {
            res.fi = q[i-1]+1;
            break;
        }
    }
    REP(i, q.sz()) {
        if (i==0 && q[i]>1) {
            res.se = 1;
            break;
        }
        if (i!=0 && q[i]!=q[i-1]+1 && q[i-1]+1>res.fi) {
            res.se = q[i-1]+1;
            break;
        }
        if (i!=0 && q[i]>q[i-1]+2) {
            res.se = q[i-1]+2;
            break;
        }
    }
    return res;
}

void fuck(int u, int x) {
    grundy[u] = x;
    int t = p[u];
    if (grundy[t]!=-1) return;
    fuck(t, MEX(t).fi);
}

int main() {
    //freopen("grundy.inp", "r", stdin);
    //freopen("grundy.out", "w", stdout);
    //ios::sync_with_stdio(0); cin.tie(0);
    scanf("%d", &n);
    FOR(i, 1, n) {
        scanf("%d", &p[i]);
        a[p[i]].push_back(i);
    }
    memset(grundy, -1, sizeof(grundy));
    FOR(i, 1, n) pq.push(ii(d[i]=a[i].sz(), i));
    while (pq.sz()) {
        int u = pq.top().se, du = pq.top().fi;
        pq.pop();
        if (du!=d[u] || du!=0) continue;
        d[p[u]]--;
        pq.push(ii(d[p[u]], p[u]));
        grundy[u] = MEX(u).fi;
    }
    //Debug(MEX(1).se);
    FOR(i, 1, n) {
        if (grundy[i]==-1) {
            FOR(j, 1, n) tmp[j] = grundy[j];
            fuck(i, MEX(i).fi);
            bool ok = true;
            FOR(j, 1, n) {
                if (grundy[j]!=MEX(j).fi)
                    ok = false;
            }
            if (ok) {cout << "POSSIBLE"; return 0;}
            ok = true;
            FOR(j, 1, n) grundy[j] = tmp[j];
            fuck(i, MEX(i).se);
            FOR(j, 1, n) {
                if (grundy[j]!=MEX(j).fi) ok = false;
            }
            if (ok) {cout << "POSSIBLE"; return 0;}
            cout << "IMPOSSIBLE";
            return 0;
        }
    }
    cout << "POSSIBLE";
}


Measured memory_bytes: 15220