#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <bool Directed, typename TEdge, bool Index> struct graph {
    using EType = TEdge;
    vector<TEdge> edges;
    vector<vector<int>> adj;
    graph(int n) : adj(n + Index) {}
    graph(int n, int m) : graph(n) { edges.reserve(m << not Directed); }
    TEdge& operator()(int e) { return edges[e]; }
    vector<int>& operator[](int u) { return adj[u]; }
    int size() { return adj.size() - Index; }
    void add_edge(const TEdge& e) {
        adj[e.u].push_back(edges.size());
        edges.push_back(e);
        if(not Directed) {
            adj[e.v].push_back(edges.size());
            edges.push_back(e.reverse());
        }
    }
};
struct edge {
    int u, v;
    edge reverse() const { return {v, u}; }
    friend ostream& operator<<(ostream& os, const edge& e) {
        return os << "(" << e.u << ", " << e.v << ")";
    }
};
template <typename TEdge, bool Index> vector<int> toposort(graph<1, TEdge, Index>& g) {
    vector<int> indeg(g.adj.size());
    for(int u = Index; u < g.adj.size(); u++) {
        for(int e : g[u]) {
            indeg[g(e).v]++;
        }
    }
    queue<int> q;
    for(int u = Index; u < g.adj.size(); u++) {
        if(indeg[u] == 0) {
            q.push(u);
        }
    }
    vector<int> ans;
    while(not q.empty()) {
        int u = q.front(); q.pop();
        ans.push_back(u);
        for(int e : g[u]) {
            if(--indeg[g(e).v] == 0) {
                q.push(g(e).v);
            }
        }
    }
    return ans;
}
auto mex1 = [](set<int>& s) {
    for(int i = 0; ; i++) {
        if(not s.count(i)) {
            return i;
        }
    }
    return -1;
};
auto mex2 = [](set<int>& s) {
    int m1 = mex1(s);
    s.insert(m1);
    int ans = mex1(s);
    s.erase(m1);
    return ans;
};
auto mex = [](graph<1, edge, 1>& g, vector<int>& nimber, int u, const function<int(set<int>&)>& mex_f) {
    set<int> s;
    for(int e : g[u]) {
        s.insert(nimber[g(e).v]);
    }
    return mex_f(s);
};
bool can(graph<1, edge, 1>& g, vector<int>& tp, const function<int(set<int>&)>& mex_s) {
    vector<int> nimber(g.adj.size(), -1);
    for(int v : tp) {
        nimber[v] = mex(g, nimber, v, mex1);
    }
    set<int> cycle;
    for(int v = 1; v <= g.size(); v++) {
        if(nimber[v] == -1) {
            cycle.insert(v);
        }
    }
    if(not cycle.empty()) {
        vector<int> pre(g.adj.size());
        for(int u : cycle) {
            for(int e : g[u]) {
                if(cycle.count(g(e).v)) {
                    pre[g(e).v] = u;
                }
            }
        }
        int s = *cycle.begin();
        nimber[s] = mex(g, nimber, s, mex_s);
        for(int k = pre[s]; k != s; k = pre[k]) {
            nimber[k] = mex(g, nimber, k, mex1);
        }
    }
    return all_of(g.edges.begin(), g.edges.end(), [&](auto& e) {
        return nimber[e.u] != nimber[e.v];
    }) and (cycle.empty() or mex(g, nimber, *cycle.begin(), mex1) == nimber[*cycle.begin()]);
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    graph<1, edge, 1> g(n, n), transpose(n, n);
    for(int v = 1; v <= n; v++) {
        int u;
        cin >> u;
        g.add_edge({u, v});
        transpose.add_edge({v, u});
    }
    auto tp = toposort(transpose);
    cout << (can(g, tp, mex1) or can(g, tp, mex2) ? "POSSIBLE" : "IMPOSSIBLE") << endl; 
    return 0;
}


Measured memory_bytes: 33408