#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <cassert>
#include <bitset>

using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)
#define randchar() ((rand() % 26) + 'a')


typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int N = 200000 + 7;
const int M = 1000000;
const ll MM = 1ll * M * M;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * inf;
const double pi = acos(-1);
const double eps = 1e-7;
const bool multipleTest = 0;

int n;
int nxt[N];
int state[N];
int f[N];
bool ring[N];
int has[N];
set<int> newHas[N];

set<int> sHas[N];
bool visited[N];
int res[N];

int st = -1;

bool check(int x) {
	for (int i = 1; i <= n; ++i) {
		newHas[i] = sHas[i];
		visited[i] = false;
		res[i] = -1;
	}
	int cur = st;
	res[cur] = x;
	
	while (!visited[cur]) {
		if (newHas[cur].count(res[cur])) return false;
		visited[cur] = true;
		newHas[nxt[cur]].insert(res[cur]);
		cur = nxt[cur];
		for (int j = 0; j < N; ++j) if (!newHas[cur].count(j)) {
			res[cur] = j;
			break;
		}
		if (res[cur] == -1) return false;
	}
	if (cur != st || res[cur] != x) return false;
	
	for (int j = 0; j < res[cur]; ++j) if (!newHas[cur].count(j)) return false;
	if (newHas[cur].count(res[cur])) return false;
	return true;
	
}

int q[N];
int top = 0;


void solve() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		scanf("%d", nxt + i);
		f[nxt[i]]++;
	}
	
	for (int i = 1; i <= n; ++i) state[i] = -1;
	for (int i = 1; i <= n; ++i) if (f[i] == 0) {
		int j = i;
		while (state[j] == -1) {
			state[j] = 1;
			j = nxt[j];
		}
		while (!ring[j]) {
			ring[j] = 1;
			j = nxt[j];
		}
		st = j;
		break;
	}
	
	if (st == -1) {
		st = 1;
	}
	
	for (int i = 1; i <= n; ++i) state[i] = -1;
	
	for (int i = 1; i <= n; ++i) if (f[i] == 0) {
		state[i] = 0;
		q[top++] = i;
	}
	
	for (int j = 0; j < top; ++j) {
		int u = q[j];
		if (state[u] == -1) {
			for (int j = 0; j < N; ++j) if (!sHas[u].count(j)) {
				state[u] = j;
				break;
			}
		}
		sHas[nxt[u]].insert(state[u]);
		f[nxt[u]]--;
		if (f[nxt[u]] == 0) q[top++] = nxt[u];
	}
	
	int cnt = 0;
	for (int j = 0; j <= N; ++j) {
		if (!sHas[st].count(j)) {
			++cnt;
			if (cnt > 2) break;
			if (check(j)) {
				puts("POSSIBLE");
				return;
			}
		}
	}
	
	puts("IMPOSSIBLE");
	
	
	
}

int main() {
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin);
	//	freopen("out.txt", "w", stdout);
#endif
	int Test = 1;
	if (multipleTest)
		cin >> Test;
	for(int i = 0; i < Test; ++i) {
		solve();
	}
	
#ifdef _LOCAL_
	cout<<"\n" << 1.0 * clock() / CLOCKS_PER_SEC<<endl;
#endif
}


Measured memory_bytes: 41344