// #includes {{{
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

//{{{ Graph
typedef int Weight;
struct Edge {
	int src, dst, rev;
	Weight weight;
	Edge(int src, int dst, Weight weight=1,int rev=-1) :
		src(src), dst(dst), weight(weight), rev(rev) { }
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
		e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
//typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

struct Graph:vector<Edges>{
	Graph(){}
	Graph(const int &n){this->assign(n,Edges());}
	//add bi-directional edge
	void addBiEdge(int from ,int to, Weight w=1){
		while(this->size()<max(from,to)+1)this->push_back(Edges());
		this->at(from).push_back(Edge(from,to,w,this->at(to).size()));
		this->at(to).push_back(Edge(to,from,w,this->at(from).size()-1));
	}
	//add directional edge
	void addEdge(int from ,int to, Weight w=1){
		while(this->size()<from+1)this->push_back(Edges());
		this->at(from).push_back(Edge(from,to,w));
	}
};
#ifdef DEBUG
#include"graph/graphviz.h"
#endif
//}}}

//{{{ Print functions
// Input/Output
template<class T>
void matrix_out(const vector<vector<T> > &x){
	REP(i,x.size()){
		REP(j,x[0].size()){
			cout<<x[i][j]<<"\t";
		}
		cout<<endl;
	}
}

template<class U,class S,class T>
U &operator<<(U &os, const pair<S,T> &p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class U,class T>
U &operator<<(U &os, const vector<T> &x) {
	os<<"vector[";
	REP(i,x.size()){
		os<<x[i];
		if(i!=x.size()-1)os<<",";
	}
	os<<"]";
	return os;
}

template<class U,class T>
U &operator<<(U &os, const deque<T> &x) {
	os<<"deque[";
	REP(i,x.size()){
		os<<x[i];
		if(i!=x.size()-1)os<<",";
	}
	os<<"]";
	return os;
}

template<class U,class T>
U &operator<<(U &os, const set<T> &x) {
	os<<"set[";
	FOR(it,x){
		os<<*it;
		if(++it!=x.end())os<<",";
		it--;
	}
	os<<"]";
	return os;
}

template<class U,class T>
U &operator<<(U &os, const list<T> &x) {
	os<<"list[";
	FOR(it,x){
		os<<*it;
		if(++it!=x.end())os<<",";
		it--;
	}
	os<<"]";
	return os;
}

template<class U,class T>
U &operator<<(U &os, const multiset<T> &x) {
	os<<"multiset[";
	FOR(it,x){
		os<<*it;
		if(++it!=x.end())os<<",";
		it--;
	}
	os<<"]";
	return os;
}



template<class U,class S,class T>
U &operator<<(U &os, const map<S,T> &x) {
	os<<"map[";
	FOR(it,x){
		os<<*it;
		if(++it!=x.end())os<<",";
		it--;
	}
	os<<"]";
	return os;
}

void printBit(int b,int k=-1){
	if(k==-1){
		int bb=1,i=0;
		while(bb){
			if(b&bb)k=i;
			bb<<=1;i++;
		}
	}
	REP(ct,k){
		cout<<b%2;
		b>>=1;
	}
	cout<<endl;
}

//}}}

//{{{ stronglyConnectedComponents(const Graph &g)
struct scc_t{
	vector<vector<int> > scc;
	vector<int> id;
};
void visit(const Graph &g, int v, scc_t &ret,
		stack<int> &S, vector<bool> &inS,
		vector<int> &low, vector<int> &num, int& time) {
	low[v] = num[v] = time;
	time++;
	S.push(v); inS[v] = true;
	for(const auto &e:g[v]){
		int w = e.dst;
		if (num[w] == -1) {
			visit(g, w, ret, S, inS, low, num, time);
			low[v] = min(low[v], low[w]);
		} else if (inS[w])
			low[v] = min(low[v], num[w]);
	}
	if (low[v] == num[v]) {
		ret.scc.push_back(vector<int>());
		while (1) {
			int w = S.top(); S.pop(); inS[w] = false;
			ret.scc.back().push_back(w);
			if (v == w) break;
		}
	}
}
scc_t stronglyConnectedComponents(const Graph& g) {
	const int n = g.size();
	scc_t ret{vector<vector<int> >(),vector<int>(n,-1)};
	vector<int> low(n,-1), num(n,-1);
	stack<int> S;
	vector<bool> inS(n);
	int time = 0;
	REP(u, n) if (num[u] == -1) visit(g, u, ret, S, inS, low, num, time);
	REP(i,ret.scc.size())REP(j,ret.scc[i].size())ret.id[ret.scc[i][j]] = i;
	return ret;
}
//}}}

Graph g;

vector<bool> vis;

vector<int> loop, rev_loop;
vector<int> nxt, rev_nxt;
vector<int> gr;

int dfs1(int u, int p = -1){
	unordered_set<int> st;
	for(auto &&e:g[u]){
		if(nxt[u]!=-1 and e.dst==nxt[u])continue;
		st.insert(dfs1(e.dst,u));
	}
	for(int i=0;;i++){
		if(st.find(i)==st.end())return gr[u] = i;
	}
}

void solve(int N, vector<int> p){
	g.assign(N,Edges());
	REP(u,N)g.addEdge(p[u],u);
	auto s(stronglyConnectedComponents(g));
	unordered_set<int> cyc;
	REP(i,s.scc.size()){
		if(s.scc[i].size()>1){
			cyc.insert(ALL(s.scc[i]));
			break;
		}
	}
	assert(cyc.size()>0);
	gr.assign(N,-1);
	nxt.assign(N,-1);
	rev_nxt.assign(N,-1);
	for(auto &&u:cyc){
		bool found = false;
		for(auto &&e:g[u]){
			if(EXIST(e.dst,cyc)){
				nxt[u] = e.dst;
				rev_nxt[e.dst] = u;
				found = true;
			}
		}
		assert(found);
	}
	int start = *cyc.begin();
	for(int u = start;;){
		loop.push_back(u);
		u = nxt[u];
		if(u==start)break;
	}
	rev_loop = loop;
	reverse(ALL(rev_loop));
	
	/*
	REP(i,loop.size()){
		nxt[loop[i]] = loop[(i+1)%loop.size()];
		rev_nxt[rev_loop[i]] = rev_loop[(i+1)%loop.size()];
	}
	*/
	int max_g = -1;
	REP(i,loop.size()){
		max_g = max(max_g, dfs1(loop[i]));
	}
	for(int t=0;t<=max_g+4;t++){
		gr[rev_loop[0]] = t;
		for(int i=1;i<rev_loop.size() + 1;i++){
			unordered_set<int> st;
			int u = rev_loop[i%rev_loop.size()];
			for(auto &e:g[u]){
				st.insert(gr[e.dst]);
			}
			for(int i=0;;i++){
				if(st.find(i)==st.end()){
					gr[u] = i;
					break;
				}
			}
		}
		if(gr[rev_loop[0]]==t){
			cout<<"POSSIBLE"<<endl;
			return;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
}

int main(){	
	int N;
	scanf("%d",&N);
	vector<int> p(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%d",&p[i]);
		p[i]--;
	}
	solve(N, p);
	return 0;
}



Measured memory_bytes: 51764