#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const int N = 2e5;
int n, cir;
VI in[N], out[N], e[N];
int gr[N], out_deg[N], visit[N], par[N], onc[N];

bool check(int c, int g){
    gr[c] = g;
    queue<int> que;
    for (int x : in[c]) que.push(x);
    while (!que.empty()){
        int x = que.front();
        que.pop();
        set<int> st;
        for (int next : out[x]){
            st.insert(gr[next]);
        }
        // cout << " v " << x << " ";
        // for (int ho : st) cout << ho << " ";
        // cout << endl;
        gr[x] = 0;
        for (int p : st){
            if (gr[x] == p) gr[x]++;
            else break;
        }
        for (int from : in[x]){
            if (from != c) que.push(from);
        }        
    }
    // REP(i,n) cout << gr[i] << " ";
    // cout << endl;
    REP(i,n){
        if (gr[i] == -1) continue;
        set<int> st;
        for (int next : out[i]){
            st.insert(gr[next]);
        }
        int gc = 0;
        for (int p : st){
            if (gc == p) gc++;
            else break;
        }
        if (gc != gr[i]) return false;
    }

    return true;
}

void dfs(int now, int past){
    visit[now] = 1;
    par[now] = past;
    for (int next : e[now]){
        if (next == past) continue;
        if (visit[next]){
            par[next] = now;
            cir = next;
            return;
        }
        dfs(next, now);
    }
}

int main() {
    cin >> n;
    REP(i,n){
        int p;
        scanf("%d", &p);
        p--;
        e[p].push_back(i);
        e[i].push_back(p);
        out[p].push_back(i);
        in[i].push_back(p);
        out_deg[p]++;
    }

    // dfs(0, -1);
    // int v = par[cir];
    // while (v != cir){
    //     onc[v] = 1;
    //     v = par[v];
    // }

    fill(gr, gr+n, -1);
    queue<int> que;
    REP(i,n){
        if (out_deg[i] == 0){
            que.push(i);
        }
    }

    while (!que.empty()){
        int x = que.front();
        que.pop();
        set<int> st;
        for (int next : out[x]){
            st.insert(gr[next]);
        }
        gr[x] = 0;
        for (int p : st){
            if (gr[x] == p) gr[x]++;
            else break;
        }
        for (int from : in[x]){
            out_deg[from]--;
            if (out_deg[from] == 0) que.push(from);
        }
    }

    // REP(i,n) cout << gr[i] << " ";
    // cout << endl;

    REP(i,n){
        if (gr[i] == -1){
            cir = i;
            break;
        }
    }

    int g1 = -1, g2 = -1;
    VI sk(n+1);
    for (int next : out[cir]) if (gr[next] != -1) sk[gr[next]] = 1;
    REP(i,n+1){
        if (!sk[i]){
            if (g1 == -1) g1 = i;
            else {g2 = i; break;}
        }
    }

    // cout << cir << g1 << g2 << endl;

    if (check(cir, g1) || check(cir, g2)) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;


    return 0;
}


Measured memory_bytes: 34560