#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], cirn[MAX_N], cirp[MAX_N];
vcn G[MAX_N], idx[MAX_N], val[MAX_N];
bool isc[MAX_N], vis[MAX_N], book[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]]);
        } else if (isc[x]) cirn[x] = 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; }
    }
}

bool check (int x, int t) {
    int tmp = -1;
    if (x == t) tmp = vall[x];
    for (int i = 0, p = 0; i < val[x].size(); ++i) {
        // printf("%d %d %d\n", x, val[x][i], p);
        if (val[x][i] != p) {
            // if (val[x][i] < p) { printf("%d %d %d\n", x, val[x][i], p); exit(1); }
            if (vall[cirn[x]] != p) { vall[x] = p; break; }
            else p++, i--;
        } else p++;
    }
    if (x == t) return vall[x] == tmp;
    return check(cirp[x], t);
}

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) printf("%d ", cir[i]); puts("");
    rep (i, 1, tc) get(cir[i]);
    int k = vall[cir[1]];
    bool flag = true;
    rep (i, 2, tc) flag &= (vall[cir[i]] == k);
    if (flag && (tc & 1)) puts("IMPOSSIBLE");
    else puts("POSSIBLE");
    // rep (i, 1, tc) {
    //     for (int y: G[cir[i]]) if (isc[y] && (y != cirn[cir[i]] || tc == 2)) cirp[cir[i]] = y;
    // }
    // printf("%d %d\n", N, tc);
    // rep (i, 1, tc) printf("%d pre:%d next:%d\n", cir[i], cirp[cir[i]], cirn[cir[i]]);
    // return 0;
    // rep (i, 1, tc) {
    //     printf("%d:\n", cir[i]);
    //     for (int x: val[cir[i]]) printf("%d ", x); puts("");
    // }
    // int cnt = 0;
    // u = cir[1];
    // for (int i: val[u]) book[i] = true;
    // rep (i, 1, N) val[i].push_back(-1);
    // rep (i, 0, N) {
    //     if (!book[i]) {
    //         cnt++;
    //         if (cnt == 1) {
    //             vall[u] = i;
    //             if (check(cirp[u], u)) print(1);
    //             // print(0);
    //             flag = i;
    //         } else {
    //             vall[u] = i;
    //             if (check(cirp[u], u) && vall[cirn[u]] == flag) print(1);
    //         }
    //     }
    //     if (cnt == 2) print(0);
    // }
    // print(0);
    return 0;
}

Measured memory_bytes: 68608