#ifndef INCLUDE_AC
    #define INCLUDE_AC
    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
    #include <fstream>
    #include <iostream>
    #include <sstream>
    #include <iomanip>
    #include <algorithm>
    #include <bitset>
    #include <array>
    #include <vector>
    #include <queue>
    #include <set>
    #include <cmath> // 変数名にy1が使えなくなるかも…。
    #include <map>
    #include <unordered_map>
    #include <unordered_set>
    #include <limits>
    #include <functional>
    #include <string>

    using int128_t = __int128_t;
    std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
        int64_t tmp; input >> tmp; value = tmp;
        return input;
    }
    std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
        output << (int64_t)value;
        return output;
    }

    namespace std {
        template<> class hash<int128_t>{
            public:
            size_t operator () ( const int128_t &x ) const {
                int64_t INF64 = std::numeric_limits<int64_t>::max();
                int64_t y1 = x / INF64;
                int64_t y2 = x % INF64;
                return hash<int64_t>()(y1) ^ hash<int64_t>()(y2);
            }
        };
    }

    int128_t imax(const int128_t a, const int128_t b) { return std::max(a, b); } // std::max, std::min は型が違うとエラーになるため、ラッパーを作る。
    int128_t imin(const int128_t a, const int128_t b) { return std::min(a, b); }
    int128_t iabs(const int128_t x) { return 0 <= x ? x : -x; }

    #define rep(i, begin, end) for(int64_t i = ((int64_t)begin); i <= ((int64_t)end); i++) // (int64_t)end としておくと、end = v.size() - 2 みたいな入力で、v.size()が1でも正常(end = -1になる）に挙動する。
    #define rev(i, begin, end) for(int64_t i = ((int64_t)begin); ((int64_t)end) <= i; i--)

    #define input1(begin, end, v1) v1.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i]; }
    #define input2(begin, end, v1, v2) v1.resize((end)+1); v2.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i]; } 
    #define input3(begin, end, v1, v2, v3) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i]; }
    #define input4(begin, end, v1, v2, v3, v4) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); v4.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i] >> v4[i]; } 
    #define input5(begin, end, v1, v2, v3, v4, v5) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); v4.resize((end)+1); v5.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i] >> v4[i] >> v5[i]; }  
    // input_arrayはbegin = 0のときのみ動作確認。Aの要素の型をテンプレートにして関数にしたほうが丁寧かもしれない。
    #define input_array(begin, N, M, A) A.resize((begin)+(N)); for (int i = 0; i < (begin)+(N); i++) { A[i].resize((begin)+(M)); } for (int i = begin; i < (begin)+(N); i++) { for (int j = begin; j < (begin)+(M); j++) { std::cin >> A[i][j]; }}

    std::vector<int> irange(const int begin, const int end) {
        std::vector<int> ret; for (int i = begin; i <= end; i++) { ret.push_back(i); }
        return ret;
    }

    template <typename T>
    std::vector<T> accumulate_vec(const std::vector<T>& vec, const bool reverse = false) {
        std::vector<T> ret; ret.resize(vec.size());
        if (reverse == false) {
            ret[0] = vec[0];
            for (int i = 1; i < ret.size(); i++) {
                ret[i] = ret[i-1] + vec[i];
            }
        } else {
            ret[ret.size()-1] = vec[ret.size()-1];
            for (int i = ret.size() - 2; 0 <= i; i--) {
                ret[i] = ret[i+1] + vec[i];
            }
        }
        return ret;
    }

    template <typename T>
    void printvec(const std::vector<T>& vec) {
        for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << std::endl;
    }
#endif


class Directed_Graph {
    public:
    struct Edge { 
        int to; int64_t cost;
    };
    typedef std::vector<std::vector<Edge>> adj_list;
    adj_list G;
    Directed_Graph() {}
    Directed_Graph(const int greatest_node_id) {
        G.resize(greatest_node_id + 1);
    }
    void add_directed_edge(const int from, const int to, const int64_t cost) {
        Edge edge; edge.to = to; edge.cost = cost;
        G[from].push_back(edge);
    }
    void add_undirected_edge(const int node1, const int node2, const int64_t cost) {
        add_directed_edge(node1, node2, cost);
        add_directed_edge(node2, node1, cost);
    }
};
    




//--code begin--

int128_t N;
std::vector<int128_t> p;
//std::string ;
//std::vector<std::string> ;
//double ;
//std::vector<double> ;

const int128_t MAX_N = 2e5 + 7;
//const int128_t MOD = 1e9 + 7;
//const int128_t INF = std::numeric_limits<int64_t>::max();
//using pair = std::pair<int64_t, int>;

std::unordered_set<int128_t> loop_set;
Directed_Graph dg(MAX_N);
std::vector<int128_t> gr;

int128_t cal_gr(const std::unordered_set<int128_t>& st) {
    rep (i, 0, N) {
        if (!st.count(i)) {
            return i;
        }
    }
    assert(false);
}

void dfs(int128_t node) {
    std::unordered_set<int128_t> st;
    for (auto e : dg.G[node]) {
        if (!loop_set.count(e.to)) {
            dfs(e.to);
            st.insert(gr[e.to]);
        }
    }
    if (!loop_set.count(node)) {
        gr[node] = cal_gr(st);
    }
}

bool check(int128_t node, int128_t g) {
    int128_t tmp = node;
    auto gcp = gr;
    gcp[node] = g;
    while (p[tmp] != node) {
        tmp = p[tmp];
        std::unordered_set<int128_t> st;
        for (auto e : dg.G[tmp]) {
            st.insert(gcp[e.to]);
        }
        gcp[tmp] = cal_gr(st);
    }
    
    std::unordered_set<int128_t> st2;
    for (auto e : dg.G[node]) {
        st2.insert(gcp[e.to]);
    }
    return cal_gr(st2) == g;
}

int main(int argc, char **argv) {
    std::cin >> N;

    input1(1, N, p);

    rep (i, 1, N) {
        dg.add_directed_edge(p[i], i, 1);
    }
    gr.resize(N+1);

    std::unordered_set<int128_t> st;
    int128_t tmp = 1;
    st.insert(tmp);

    while (st.count(p[tmp]) == 0) {
        tmp = p[tmp];
        st.insert(tmp);
    }

    while (loop_set.count(p[tmp]) == 0) {
        tmp = p[tmp];
        loop_set.insert(tmp);
    }

    rep (i, 1, N) {
        if (loop_set.count(i)) {
            dfs(i);
        }
    }

    std::unordered_set<int128_t> st2;
    for (auto e : dg.G[tmp]) {
        if (!loop_set.count(e.to)) {
            st2.insert(gr[e.to]);
        }
    }

    int128_t cnt = 0;
    rep (i, 0, N + 1) {
        if (!st2.count(i)) {
            if (check(tmp, i)) {
                std::cout << "POSSIBLE" << std::endl;
                return 0;
            }
            cnt++;
        }
        if (cnt == 2) {
            std::cout << "IMPOSSIBLE" << std::endl;
            return 0;
        }
    }

    assert(false);
    return 0;
}

Measured memory_bytes: 44624