// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //
// 🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤🖤 //

// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::pair;using std::set;using std::string;using std::vector;
using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;
#define ff first
#define ss second
#define pb emplace_back
template<typename T>void _dbg(const char*_s,T _h){cerr<<_s<<" = "<<_h<<"\n";}
template<typename T,typename...Ts>void _dbg(const char*_s,T _h,Ts..._t){int _b=0;while(((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',')cerr<<*_s++;cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);}
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 
#endif
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#endif
}}init;

const int N = 2e5 + 1;
vector<int> g[N];
vector<int> w;
int u[N];
int c[N];
void dfs1(int v) {
    u[v] = 1;
    w.pb(v);
    for (int t : g[v]) {
        if (!u[t]) dfs1(t);
        else if (u[t] == 1) {
            for (int j = (int)w.size() - 1; j >= 0; --j) {
                c[w[j]] = 1;
                if (w[j] == t) break;
            }
        }
    }
    w.pop_back();
    u[v] = 2;
}

int a[N];
void dfs2(int v) {
    set<int> mex;
    for (int to : g[v])
        if (!c[to]) {
            dfs2(to);
            mex.insert(a[to]);
        }
    for (int i = 0; ; ++i)
        if (mex.find(i) == mex.end()) {
            a[v] = i;
            break;
        }
}

void dfs3(int v) {
    set<int> mex;
    u[v] = 1;
    w.pb(v);
    for (int to : g[v]) {
        if (!u[to]) {
            if(c[to]) dfs3(to);
            dbg(v, to, a[to]);
        }
        mex.insert(a[to]);
    }
        
    for (int i = 0; ; ++i)
        if (mex.find(i) == mex.end()) {
            a[v] = i;
            break;
        }    
}

int main() {

    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int p;
        cin >> p;
        g[p].pb(i);
    }

    for (int i = 1; i <= n; ++i)
        if (!u[i])
            dfs1(i);

    dbg("dfs1");

    for (int i = 1; i <= n; ++i)
        if (c[i])
            dfs2(i);
    dbg("dfs2");

    int v = -1;
    for (int i = 1; v == -1 && i <= n; ++i)
        if (c[i])
            v = i;

    dbg(v);
    int b;
    {
        set<int> mex;
        for (int to : g[v])
            if (!c[to])
                mex.insert(a[to]);

        for (int i = a[v] + 1; ; ++i)
            if (mex.find(i) == mex.end()) {
                b = i;
                break;
            }
    }
    
    memset(u, 0, sizeof u);
    int val, was = a[v];
    dfs3(v);
    for (int i = 1; i <= n; ++i)
        dbg(i, a[i]);
    int last = w.back();
    {
        set<int> mex;
        for (int to : g[last])
            mex.insert(a[to]);

        for (int i = 0; ; ++i)
            if (mex.find(i) == mex.end()) {
                val = i;
                break;
            }
    }
    if (val == a[last] && was == a[v]) {
        cout << "POSSIBLE\n";
        return 0;
    }
    dbg(b);
    a[v] = b;

    memset(u, 0, sizeof u);
    was = a[v];
    dfs3(v);
    for (int i = 1; i <= n; ++i)
        dbg(a[i]);
    {
        set<int> mex;
        for (int to : g[last])
            mex.insert(a[to]);

        for (int i = 0; ; ++i)
            if (mex.find(i) == mex.end()) {
                val = i;
                break;
            }
    }
    if (val == a[last] && was == a[v]) {
        cout << "POSSIBLE\n";
        return 0;
    }

    cout << "IMPOSSIBLE\n";

    return 0;
}


Measured memory_bytes: 29428