//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
// int findmex(){
// 	int low=0;
// 	int high=vec.size()-1;
// 	int ans=vec.size();
// 	int mid;
// 	while(low<=high){
// 		mid=(low+high)/2;
// 		if(vec[mid]==mid){
// 			low=mid+1;
// 		}
// 		else{
// 			ans=mid;
// 			high=mid-1;
// 		}
// 	}
// 	return ans;
// }

int a[212345],inn[212345],outdeg[212345],rem[212345],ans[212345];
vector<vi> adj(212345);
vi vec;
int main(){
    std::ios::sync_with_stdio(false);
    int n,i,j;
    cin>>n;
    f(i,1,n+1){
    	cin>>a[i];
    }
    f(i,1,n+1){
    	adj[a[i]].pb(i);
    	inn[i]=a[i];
    	outdeg[a[i]]++;
    }
    stack<int> st;
    f(i,1,n+1){
    	if(outdeg[i]==0){
    		st.push(i);
    		//cout<<i<<endl;
    	}
    }
    int val;
    //cout<<st.size()<<endl;
    while(!st.empty()){
    	//cout<<"Dads";
    	vec.clear();
    	val=st.top();
    	rem[st.top()]=1;
    	st.pop();
    	rep(i,adj[val].size()){
    		vec.pb(ans[adj[val][i]]);
    	}
    	outdeg[inn[val]]--;
    	if(outdeg[inn[val]]==0)
    		st.push(inn[val]);
    	sort(vec.begin(),vec.end());
    	vec.resize(unique(vec.begin(),vec.end())-vec.begin());
    	ans[val]=vec.size();
    	j=0;
    	rep(i,vec.size()){
    		if(vec[i]!=j){
    			ans[val]=j;
    			break;
    		}
    		j++;
    	}
    	//vec.clear();

    }
    //cout<<i<<endl;
    f(i,1,n+1){
    	//cout<<rem[i]<<endl;
    	if(!rem[i]){
    		//cout<<i<<endl;
    		break;
    	}
    }
    //cout<<i<<endl;
    val=i;
    //cout<<i<<endl;
    if(i==n+1){
    	cout<<"POSSIBLE"<<endl;
    	return 0;
    }
    vec.clear();
    rep(i,adj[val].size()){
    	if(rem[adj[val][i]])
		vec.pb(ans[adj[val][i]]);
	}
	sort(vec.begin(),vec.end());
	//j++;
	vec.resize(unique(vec.begin(),vec.end())-vec.begin());
	ans[val]=vec.size();
	j=0;
	rep(i,vec.size()){
		if(vec[i]!=j){
			ans[val]=j;
			break;
		}
		j++;
	}
	int mex=ans[val];
	//cout<<mex<<endl;
	int cur=val,prev;
	val=inn[val];
	while(val!=cur){
		vec.clear();
    	//int val=st.top();
    	//rem[st.top()]=1;
    	//st.pop();
    	rep(i,adj[val].size()){
    		vec.pb(ans[adj[val][i]]);
    	}
    	//outdeg[inn[val]]--;
    	//if(outdeg[inn[val]]==0)
    		//st.push(inn[val]);
    	sort(vec.begin(),vec.end());
    	vec.resize(unique(vec.begin(),vec.end())-vec.begin());
    	ans[val]=vec.size();
    	j=0;
    	rep(i,vec.size()){
    		if(vec[i]!=j){
    			ans[val]=j;
    			break;
    		}
    		j++;
    	}
    	prev=val;
    	val=inn[val];
	}
	//cout<<ans[1]<<endl;
	if(ans[prev]!=ans[cur]){

		cout<<"POSSIBLE"<<endl;
		return 0;
	}

	val=cur;
	ans[val]++;
	val=inn[val];
	while(val!=cur){
		//cout
		vec.clear();
    	//int val=st.top();
    	//rem[st.top()]=1;
    	//st.pop();
    	rep(i,adj[val].size()){
    		//cout<<"SAsa";
    		vec.pb(ans[adj[val][i]]);
    	}
    	//outdeg[inn[val]]--;
    	//if(outdeg[inn[val]]==0)
    		//st.push(inn[val]);
    	sort(vec.begin(),vec.end());
    	//cout<<vec.size();
    	vec.resize(unique(vec.begin(),vec.end())-vec.begin());
    	ans[val]=vec.size();
    	j=0;
    	//cout<<val<<" "<<vec.size()<<endl;
    	rep(i,vec.size()){
    		if(vec[i]!=j){
    			ans[val]=j;
    			break;
    		}
    		j++;
    	}
    	prev=val;
    	val=inn[val];
	}
	//cout<<ans[3]<<" "<<cur<<endl;
	if(ans[prev]==ans[cur]-1){
		cout<<"POSSIBLE"<<endl;
		return 0;
	}

	cout<<"IMPOSSIBLE"<<endl;
	return 0;




    return 0;      

}



Measured memory_bytes: 14592