#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int n;
vector<vector<int> > g;
vector<vector<int> > rev;
bool loop[200010];
bool used[200010];
int s[200010];
int nxt[200010];
set<int> st[200010];
int dfs(int id){
    for(auto x:g[id]){
        if(loop[x])continue;
        int k = dfs(x);
        st[id].insert(k);
    }
    rep(i,200010){
        if(st[id].count(i)==0){
            return i;
        }
    }
}
int main(){
    cin >> n;
    g.resize(n);
    rev.resize(n);
    rep(i,n){
        int a;
        cin >> a;
        a--;
        g[a].push_back(i);
        rev[i].push_back(a);
    }
    int id = 0;
    rep(i,200010){
        id = rev[id][0];
    }
    rep(i,200010){
        loop[id] = 1;
        id = rev[id][0];
    }
    rep(i,200010){
        if(used[id])break;
        dfs(id);
        used[id] = 1;
        nxt[rev[id][0]] = id;
        id = rev[id][0];
    }
    int pid = id;
    int fir=-1,sec;
    rep(i,200010){
        if(st[id].count(i)==0){
            if(fir==-1)fir = i;
            else{
                sec = i;
                break;
            }
        }
    }
    rep(i,200001){
        s[i] = -1;
    }
    s[pid] = fir;
    id = rev[id][0];
    rep(i,200010){
        if(id==pid){
            bool ok;
            rep(j,200010){
                if(st[id].count(j)==0&&j!=s[nxt[id]]){
                    if(s[id]==j){
                        ok = 1;
                    }else{
                        ok = 0;
                    }
                    break;
                }
            }
            if(ok){
                cout << "POSSIBLE" <<endl;
                return 0;
            }
            break;
        }else{
            rep(j,200010){
                if(st[id].count(j)==0&&j!=s[nxt[id]]){
                    s[id] = j;
                    break;
                }
            }
        }
        id = rev[id][0];
    }
    rep(i,200001){
        s[i] = -1;
    }
    s[pid] = sec;
    id = pid;
    id = rev[id][0];
    rep(i,200010){
        if(id==pid){
            bool ok;
            rep(j,200010){
                if(st[id].count(j)==0&&j!=s[nxt[id]]){
                    if(s[id]==j){
                        ok = 1;
                    }else{
                        ok = 0;
                    }
                    break;
                }
            }
            if(ok){
                cout << "POSSIBLE" <<endl;
                return 0;
            }
            break;
        }else{
            rep(j,200010){
                if(st[id].count(j)==0&&j!=s[nxt[id]]){
                    s[id] = j;
                    break;
                }
            }
        }
        id = rev[id][0];
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 33152