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

int N;
int sum[200020] = {0};//出次数
vector<int> to[200020],from[200020];
vector<int> loop,mem;
bool visit[200020] = {0};
bool ele_loop[200020] = {0};
int num[200020] = {0};
int can[200020] = {0};

void construct(int v)
{
    if(sum[v] != 0)return;
    if(visit[v])return;
    visit[v] = true;
    int res = 0;
    for(int i = 0; i < to[v].size(); i++)
    {
        can[num[to[v][i]]] = v;
    }
    for(int i = 0; i < N; i++)
    {
        if(can[res] == v)res++;
        else break;
    }
    sum[from[v][0]]--;
    num[v] = res;
    construct(from[v][0]);
    return;
}

bool search_loop(int v)
{
    if(visit[v])
    {
        for(int i = mem.size() - 1; i >= 0; i--)
        {
            loop.push_back(mem[i]);
            if(mem[i] == v)return true;
        }
    }
    visit[v] = true;
    mem.push_back(v);
    for(int i = 0; i < from[v].size(); i++)
    {
        if(search_loop(from[v][i]))return true;
    }
    mem.pop_back();
    return false;
}

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)
    {
        int a;
        scanf("%d",&a);
        to[a].push_back(i + 1);
        from[i + 1].push_back(a);
        sum[a]++;
    }
    for(int i = 1; i <= N; i++)
    {
        if(sum[i])
        {
            search_loop(i);
            break;
        }
    }
    for(int i = 0; i < loop.size(); i++)ele_loop[loop[i]] = true;
    for(int i = 1; i <= N; i++)visit[i] = false;
    reverse(loop.begin(),loop.end());
    for(int i = 1; i <= N; i++)
    {
        if(sum[i] == 0)
        {
            construct(i);
        }
    }

    //for(int i = 0; i < loop.size(); i++)printf("%d ",loop[i]);printf("\n");
    //for(int i = 1; i <= N; i++)printf("%d ",num[i]);printf("\n");

    for(int i = 0; i <= N; i++)can[i] = -1;
    for(int i = 0; i < loop.size(); i++)
    {
        int now = loop[i];
        int res = 0;
        for(int j = 0; j < to[now].size(); j++)
        {
            if(ele_loop[to[now][j]] && i == 0)continue;
            can[num[to[now][j]]] = i;
        }
        for(int j = 0; j < N; j++)
        {
            if(can[res] == i)res++;
            else break;
        }
        num[now] = res;
        if(i == loop.size() - 1)
        {
    //for(int j = 1; j <= N; j++)printf("%d ",num[j]);printf("\n");
            if(num[loop[0]] != res)
            {
                printf("POSSIBLE\n");
                return 0;
            }
        }
    }

    for(int i = 0; i <= N; i++)can[i] = -1;
    int last;
    for(int i = 0; i < loop.size(); i++)
    {
        int now = loop[i];
        int res = 0;
        for(int j = 0; j < to[now].size(); j++)
        {
            if(ele_loop[to[now][j]] && i == 0)continue;
            can[num[to[now][j]]] = i;
        }
        if(i == 0)
        {
            bool flag = false;
            for(int j = 0; j < N; j++)
            {
                if(can[res] == i)
                {
                    res++;
                }
                else if(!flag)
                {
                    last = res;
                    res++;
                    flag = true;
                }
                else break;
            }
            num[now] = res;
            continue;
        }
        for(int j = 0; j < N; j++)
        {
            if(can[res] == i)res++;
            else break;
        }
        num[now] = res;
        if(i == loop.size() - 1)
        {
    //for(int j = 1; j <= N; j++)printf("%d ",num[j]);printf("\n");
            if(last == res)
            {
                printf("POSSIBLE\n");
                return 0;
            }
        }
    }

    //for(int i = 1; i <= N; i++)printf("%d ",num[i]);printf("\n");



    printf("IMPOSSIBLE\n");

    return 0;
}


Measured memory_bytes: 33008