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

long long N;
vector<long long> tree[200005];
vector<long long> loopvec;
set<long long> loopset;
long long loopvisit[200005];

long long paint[200005];
long long work[200005];

bool dfsloop(long long cur, long long col){
	//cout << "cur = " << cur << endl;
	if(loopvisit[cur] == col){
		return true;
	}
	if(loopvisit[cur] != 0){
		return false;
	}
	loopvisit[cur] = col;

	for(long long i = 0; i < tree[cur].size(); i++){
		if(dfsloop(tree[cur][i], col)){
			loopvec.push_back(cur);
			loopset.insert(cur);
			return true;
		}
	}
	return false;
}

void markloop(){
	long long col = 1;
	for(long long i = 0; i < N; i++){
		if(loopvisit[i] != 0){
			continue;
		}
		dfsloop(i, col);
		col++;
	}
}

bool isloop(long long node){
	return (loopset.count(node) != 0);
}

long long paintunloopdfs(long long node){
	if(tree[node].size() == 0){
		paint[node] = 0;
		return 0;
	}
	vector<long long> vec;
	for(long long i = 0; i < tree[node].size(); i++){
		vec.push_back(paintunloopdfs(tree[node][i]));
	}
	sort(vec.begin(), vec.end());
	long long cur = 0;
	for(long long i = 0; i < vec.size(); i++){
		if(vec[i] == cur){
			cur++;
		}
	}
	paint[node] = cur;
	return cur;
}

void paintunloop(){
	for(long long i = 0; i < loopvec.size(); i++){
		long long start = loopvec[i];
		for(long long j = 0; j < tree[start].size(); j++){
			if(!isloop(tree[start][j])){
				paintunloopdfs(tree[start][j]);
			}
		}
	}
}

bool paintloop(long long cur){
	vector<long long> chs;
	for(long long i = 0; i < tree[cur].size(); i++){
		if(work[tree[cur][i]] == -1){
			paintloop(tree[cur][i]);
		}
		chs.push_back(work[tree[cur][i]]);
	}
	sort(chs.begin(), chs.end());

	long long col = 0;
	for(long long i = 0; i < chs.size(); i++){
		if(chs[i] == col){
			col++;
		}
	}
	if(work[cur] != -1 && work[cur] != col){
		return false;
	}else{
		work[cur] = col;
	}
	return true;
}

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long p;
		cin >> p;
		p--;
		tree[p].push_back(i);
	}

	markloop();

	if(loopvec.size() == 0){
		cout << "POSSIBLE" << endl;
		return 0;
	}

	/*
	for(long long i = 0; i < N; i++){
		cout << "loopvisit[" << i << "] = " << loopvisit[i] << endl;
	}
	for(long long i = 0; i < loopvec.size(); i++){
		cout << loopvec[i] << endl;
	}
	*/
	for(long long i = 0; i < 200005; i++){
		paint[i] = -1;
	}

	paintunloop();

	//for(long long i = 0; i < N; i++){
	//	cout << i << " : "  << paint[i] << endl;
	//}

	vector<long long>chs;
	long long node = loopvec[0];
	for(long long i = 0; i < tree[node].size(); i++){
		if(!isloop(tree[node][i])){
			chs.push_back(paint[tree[node][i]]);
		}
	}

	for(long long i = 0; i < 200005; i++){
		work[i] = paint[i];
	}

	sort(chs.begin(), chs.end());

	long long cur = 0;
	for(long long i = 0; i < chs.size(); i++){
		if(chs[i] == cur){
			cur++;
		}
	}

	//cout << node << " col " << cur << endl;
	work[node] = cur;
	if(paintloop(node)){
		cout << "POSSIBLE" << endl;
		return 0;
	}

	//for(long long i = 0; i < N; i++){
	//	cout << i << " : "  << work[i] << endl;
	//}

	//if(check()){
	//	cout << "POSSIBLE" << endl;
	//	return;
	//}

	for(long long i = 0; i < 200005; i++){
		work[i] = paint[i];
	}

	cur++;
	for(long long i = 0; i < chs.size(); i++){
		if(chs[i] == cur){
			cur++;
		}
	}

	work[node] = cur;
	if(paintloop(node)){
		cout << "POSSIBLE" << endl;
		return 0;
	}


	cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 37488