#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

long long min(long long a, long long b) {return a < b ? a : b;}
long long min(int a, long long b) {return a < b ? a : b;}
long long min(long long a, int b) {return a < b ? a : b;}
long long min(int a, int b) {return a < b ? a : b;}

long long max(long long a, long long b) {return a > b ? a : b;}
long long max(int a, long long b) {return a > b ? a : b;}
long long max(long long a, int b) {return a > b ? a : b;}
long long max(int a, int b) {return a > b ? a : b;}

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int N = 522220;
const int MOD = 1e9 + 7;
const double eps = 1e-8;
const int K = 5;

int n, p[N];
vector<int> graph[N];
vector<int> ugraph[N];
int vis[N];
int par[N];
int mark;
int height[N];
int on_cycle[N];

void dfs(int v, int p)
{
    par[v] = p;
    if (vis[v] == 1)
    {
        mark = v;
        return;
    }
    vis[v] = 1;
    for (auto u : ugraph[v])
    {
        dfs(u, v);
    }
}

int mex1[N], mex2[N], computed[N];
int mini_dp[N];

void dp_call(int v)
{
    if (graph[v].size() == 0)
    {
        mini_dp[v] = 0;
        return;
    }
    vector<int> cnt(graph[v].size() + 1);
    for (auto u : graph[v])
    {
        dp_call(u);
        if (mini_dp[u] < cnt.size()) cnt[mini_dp[u]] = 1;
    }
    for (int x = 0; x < cnt.size(); x++)
    {
        if (cnt[x] == 0)
        {
            mini_dp[v] = x;
            return;
        }
    }
}

int possib(int v, int pr)
{
    if (computed[v])
    if (pr != mex1[v]) return mex1[v];
    else return mex2[v];
    for (auto u : graph[v])
    {
        if (on_cycle[u] == 0) dp_call(u);
    }
    computed[v] = 1;
    vector<int> cnt(graph[v].size() + 3);
    for (auto u : graph[v]) if (on_cycle[u] == 0 && mini_dp[u] < cnt.size()) cnt[mini_dp[u]]++;
    int t = 1;
    for (int i = 0; i < cnt.size(); i++)
    {
        if (t && cnt[i] == 0) t = 0, mex1[v] = i;
        else if (cnt[i] == 0)
        {
            mex2[v] = i;
            break;
        }
    }
    if (pr != mex1[v]) return mex1[v];
    else return mex2[v];
}

int res[N];

signed main()
{
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> p[i];
    for (int i = 1; i <= n; i++) graph[p[i]].push_back(i), ugraph[i].push_back(p[i]);
    dfs(1, -1);
    vector<int> cycle;
    cycle.push_back(mark);
    int v = p[mark];
    while (v != mark)
    {
        cycle.push_back(v);
        v = p[v];
    }
    for (auto u : cycle) on_cycle[u] = 1; 
    //cout << "\n";
    //cout << endl;
    possib(cycle[0], 0);
    //cout << mex1[cycle[0]] << " " << mex2[cycle[0]] << endl;
    res[0] = mex1[cycle[0]];
    for (int i = 1; i < cycle.size(); i++)
    {
        res[i] = possib(cycle[i], res[i - 1]);
    }
    if (possib(cycle[0], res[cycle.size() - 1]) == mex1[cycle[0]]) cout << "POSSIBLE", exit(0);
    
    res[0] = mex2[cycle[0]];
    for (int i = 1; i < cycle.size(); i++)
    {
        res[i] = possib(cycle[i], res[i - 1]);
    }
    if (possib(cycle[0], res[cycle.size() - 1]) == mex2[cycle[0]]) cout << "POSSIBLE", exit(0);
    
    cout << "IMPOSSIBLE";
}


Measured memory_bytes: 77040