#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>

namespace IO {
    template <typename _T>
    inline bool read (_T& x) {
        x = 0;
        _T y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return false;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return true;
    }

    template <typename _T>
    inline _T input () {
        _T x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return x;
    }
};
using namespace IO;

namespace modular {
    const int MOD = 1000000007;

    inline int add (int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }

    inline void inc (int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }

    inline int mul (int x, int y) { return 1LL * x * y % MOD; }

    inline int qpow (int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x)) if (y & 1) ans = mul(ans, x);
        return ans;
    }
};

#define reg register
#define MAX_N 400007
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for(int i = l; i <= r; ++i)
#define lep(i, l, r) for(int i = l; i < r; ++i)
#define irep(i, r, l) for(int i = r; i >= l; --i)
#define ilep(i, r, l) for(int i = r; i > l; --i)
typedef long long ll;
typedef std::vector<int> vcn;

int N, tc, flag;
int head[MAX_N], to[MAX_N << 1], nxt[MAX_N << 1], cap;
int cir[MAX_N], vall[MAX_N];
vcn G[MAX_N], idx[MAX_N], val[MAX_N];
bool isc[MAX_N], vis[MAX_N];

inline void addE (int u, int v) {
    nxt[++cap] = head[u];
    head[u] = cap;
    to[cap] = v;
}

inline void print (bool p) { /*rep (i, 1, N) printf("%d ", vall[i]); puts(""); */ puts(p ? "POSSIBLE" : "IMPOSSIBLE"); exit(0); }

void dfs (int x, int las) {
    vis[x] = true;
    for (int i = 0, y = G[x][i], z = idx[x][i]; i < G[x].size(); ++i, y = G[x][i], z = idx[x][i]) if (z != las && !isc[y]) {
        if (vis[y]) {
            flag = y;
            isc[x] = true;
        } else {
            dfs(y, z);
            if (isc[y] && flag) isc[x] = true;
        }
    }
    if (flag == x) flag = 0;
    if (isc[x]) cir[++tc] = x;
}

void get (int x) {
    for (int i = head[x]; i; i = nxt[i]) 
        if (!isc[to[i]]) {
            get(to[i]);
            val[x].push_back(vall[to[i]]);
        }
    std::sort(val[x].begin(), val[x].end());
    val[x].erase(std::unique(val[x].begin(), val[x].end()), val[x].end());
    if (!val[x].size()) return vall[x] = 0, void();
    vall[x] = -1;
    for (int i = 0; i <= val[x].size(); ++i) {
        if (i == val[x].size()) { vall[x] = i; break; }
        if (val[x][i] != i) { vall[x] = i; break; }
    }
}

int main () {
#ifdef LOCAL
    FIN("in");
#endif
    read(N);
    int u;
    rep (i, 1, N) {
        read(u);
        addE(u, i);
        G[u].push_back(i), G[i].push_back(u);
        idx[u].push_back(cap), idx[i].push_back(cap);
    }
    dfs(1, 0);
    rep (i, 1, tc) get(cir[i]);
    int k = vall[cir[1]];
    bool flag = true;
    rep (i, 2, tc) flag &= (vall[cir[i]] == k);
    print(!(flag && (tc & 1)));
    return 0;
}

Measured memory_bytes: 65024