#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <cassert>

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define PI acos(-1.0)

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef vector <ll> vll;

int in[200000];
int n;
vector <int> out[200000];
vector <int> rev[200000];
int outDeg[200000];
int val[200000];

bool cmp(int a, int b) {
	return val[a] < val[b];
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &in[i]);
		in[i]--;
		rev[i].push_back(in[i]);
		out[in[i]].push_back(i);
		outDeg[in[i]]++;
	}
	for (int i = 0; i < n; i++) val[i] = -1;
	vector <int> zeroes;
	for (int i = 0; i < n; i++) if (outDeg[i] == 0 && val[i] == -1) {
		zeroes.push_back(i);
	}
	for (int i = 0; i < zeroes.size(); i++) {
		sort(out[zeroes[i]].begin(), out[zeroes[i]].end(), cmp);
		int cnt = 0;
		for (int j = 0; j < out[zeroes[i]].size(); j++) {
			if (val[out[zeroes[i]][j]] > cnt) {
				break;
			} else if (val[out[zeroes[i]][j]] == cnt) cnt++;
		}
		val[zeroes[i]] = cnt;
		for (int j = 0; j < rev[zeroes[i]].size(); j++) {
			outDeg[rev[zeroes[i]][j]]--;
			if (outDeg[rev[zeroes[i]][j]] == 0)
				zeroes.push_back(rev[zeroes[i]][j]);
		}
	}
	if (zeroes.size() == n) {
		cout << "POSSIBLE" << endl;
		return 0;
	}
	int start = 0;
	for (; start < n; start++) if (val[start] == -1) break;
	sort(out[start].begin(), out[start].end(), cmp);
	val[start] = 0;
	for (int i = 1; i < out[start].size(); i++) {
		if (val[out[start][i]] > val[start])
			break;
		else if (val[out[start][i]] == val[start])
			val[start]++;
	}
	int cur = in[start];
	while (cur != start) {
		sort(out[cur].begin(), out[cur].end(), cmp);
		val[cur] = 0;
		for (int i = 0; i < out[cur].size(); i++)
			if (val[out[cur][i]] > val[cur]) break;
			else if (val[out[cur][i]] == val[cur]) val[cur]++;
		cur = in[cur];
	}
	bool isGood = true;
	for (int i = 0; i < n; i++) {
		int tmp = 0;
		sort(out[i].begin(), out[i].end(), cmp);
		for (int j = 0; j < out[i].size(); j++) 
			if (val[out[i][j]] > tmp) break;
			else if (val[out[i][j]] == tmp) tmp++;
		if (tmp != val[i]) {
			isGood = false;
			break;
		}
	}
	if (isGood) {
		cout << "POSSIBLE" << endl;
		return 0;
	}
	val[start]++;
	for (int i = 1; i < out[start].size(); i++) 
		if (val[out[start][i]] > val[start]) break;
		else if (val[out[start][i]] == val[start]) val[start]++;
	cur = in[start];
	while (cur != start) {
		sort(out[cur].begin(), out[cur].end(), cmp);
		val[cur] = 0;
		for (int i = 0; i < out[cur].size(); i++)
			if (val[out[cur][i]] > val[cur]) break;
			else if (val[out[cur][i]] == val[cur]) val[cur]++;
		cur = in[cur];
	}
	isGood = true;
	for (int i = 0; i < n; i++) {
		int tmp = 0;
		sort(out[i].begin(), out[i].end(), cmp);
		for (int j = 0; j < out[i].size(); j++) 
			if (val[out[i][j]] > tmp) break;
			else if (val[out[i][j]] == tmp) tmp++;
		if (tmp != val[i]) {
			isGood = false;
			break;
		}
	}
	if (isGood) {
		cout << "POSSIBLE" << endl;
		return 0;
	}	
	cout << "IMPOSSIBLE" << endl;
	return 0;
}


Measured memory_bytes: 23552