#include<cstdio>
#include<vector>
#include<algorithm>
using std::vector;
//ud && d
vector<int>g[200005];
vector<int>rg[200005];
int in[200005];
int cycle[200005];
int p[200005];
int parent[200005];
int vis[200005];
vector<int>son[200005];
int value[200005];
int queue[200005];
int offer[200005][2];
int f[200005];

int find(int u){
    if(p[u]==u) return u;
    else return p[u] = find(p[u]);
}

void merge(int u,int v){
    int x = find(u), y = find(v);
    p[y] = x;
}

void dfs(int u){
    for(int v: g[u]){
        if(parent[v]==0){
            parent[v] = u;
            dfs(v);
        }
    }
}

int findCycle(int n){
    for(int i = 1; i <= n; i++) p[i] = i;
    int x = -1, y = -1;
    for(int u = 1; u <= n; u++){
        if(x!=-1) break;
        for(int v: g[u]){
            if(find(u)!=find(v)) merge(u,v);
            else{
                x = u, y = v;
                break;
            }
        }
    }
    if(x==-1) return 0;
    else{
        parent[y] = -1;
        dfs(y);
        if(parent[x]==0) return 0;
        int size = 0;
        int cur = x;
        while(cur!=-1){
            cycle[++size] = cur;
            cur = parent[cur];
        }
        for(int i = 1; i <= size; i++){
            int j = size-i+1;
            if(i>=j) break;
            else{
                int t = cycle[i];
                cycle[i] = cycle[j];
                cycle[j] = t;
            }
        }
        return size;
    }
}

int getMex(vector<int>& set,int n){
    std::sort(set.begin(),set.end());
    int p = 0;
    for(int i = 0; i <= n+1; i++){
        while(p<(int)set.size() && set[p]<i) p++;
        if(p>=(int)set.size() || set[p]!=i) return i;
    }
    return -1;
}

void topo(int n){
    int h = 1, t = 0;
    for(int i = 1; i <= n; i++){
        if(in[i]==0){
            queue[++t] = i;
        }
    }
    while(h<=t){
        int u = queue[h++];
        value[u] = getMex(son[u],n);
        for(int v: rg[u]){
            in[v]--;
            son[v].push_back(value[u]);
            if(in[v]==0){
                queue[++t] = v;
            }
        }
    }
}

void preWork(int n,int size){
    for(int i = 1; i <= size; i++){
        int u = cycle[i];
        offer[u][0] = getMex(son[u],n);
        son[u].push_back(offer[u][0]);
        offer[u][1] = getMex(son[u],n);
    }
}

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n; i++){
        int p;
        scanf("%d",&p);
        //in[]++;
        g[p].push_back(i);
        rg[i].push_back(p);
        in[p]++;
    }
    int size = findCycle(n);
    if(size==0) printf("POSSIBLE\n");
    else{
        topo(n);
        preWork(n,size);
        /*for(int i = 1; i <= size; i++){
            int u = cycle[i];
            printf("u = %d: %d %d\n",u,offer[u][0],offer[u][1]);
        }*/
        int ok = 0;
        /*f[1][0] = 1, f[1][1] = 0;
        for(int i = 2; i <= size; i++){
            f[i][0] = f[i][1] = 0;
            int last = cycle[i-1], cur = cycle[i];
            int need = offer[cur][0];
            if(offer[last][0]!=need) f[i][0] |= f[i-1][0];
            if(offer[last][1]!=need) f[i][0] |= f[i-1][1];
            if(offer[last][0]==need) f[i][1] |= f[i-1][0];
            if(offer[last][1]==need) f[i][1] |= f[i-1][1];
        }
        int head = offer[1][0];
        if(offer[cycle[size]][0]!=head) ok |= f[size][0];
        if(offer[cycle[size]][1]!=head) ok |= f[size][1];
        f[1][1] = 1, f[1][0] = 0;
        for(int i = 2; i <= size; i++){
            f[i][0] = f[i][1] = 0;
            int last = cycle[i-1], cur = cycle[i];
            int need = offer[cur][0];
            if(offer[last][0]!=need) f[i][0] |= f[i-1][0];
            if(offer[last][1]!=need) f[i][0] |= f[i-1][1];
            if(offer[last][0]==need) f[i][1] |= f[i-1][0];
            if(offer[last][1]==need) f[i][1] |= f[i-1][1];
        }
        head = offer[1][0];
        if(offer[cycle[size]][0]==head) ok |= f[size][0];
        if(offer[cycle[size]][1]==head) ok |= f[size][1];*/
        f[1] = offer[cycle[1]][0];
        for(int i = 2; i <= size; i++){
            int need = offer[cycle[i]][0], next = offer[cycle[i]][1];
            if(f[i-1]!=need) f[i] = need;
            else f[i] = next;
        }
        if(f[size]!=f[1]) ok = 1;
        f[1] = offer[cycle[1]][1];
        for(int i = 2; i <= size; i++){
            int need = offer[cycle[i]][0], next = offer[cycle[i]][1];
            if(f[i-1]!=need) f[i] = need;
            else f[i] = next;
        }
        if(f[size]==offer[cycle[1]][0]) ok = 1;
        if(ok) printf("POSSIBLE\n");
        else printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 47668