#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 200005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

vi to[MX];
vi t;

int ui;
vi used, vs;
int dfs(int v) {
  if (used[v] == ui) return v;
  if (used[v]) return -1;
  used[v] = ui;
  rep(i,sz(to[v])) {
    int u = to[v][i];
    int r = dfs(u);
    if (r == -1) continue;
    vs.pb(v);
    if (v == r) return -1;
    return r;
  }
  return -1;
}

int gfs(int v) {
  set<int> s;
  rep(i,sz(to[v])) {
    int u = to[v][i];
    if (t[u]) continue;
    int r = gfs(u);
    s.insert(r);
  }
  for (int i = 0;; ++i) {
    if (s.count(i)) continue;
    return i;
  }
}

int main() {
  int n;
  scanf("%d",&n);
  rep(i,n) {
    int p;
    scanf("%d",&p);
    --p;
    to[p].pb(i);
  }
  used = vi(n); ui = 1;
  rep(i,n) if (!used[i]) {
    dfs(i);
    ++ui;
    if (sz(vs)) break;
  }

  t = vi(n);
  for (int v : vs) t[v] = 1;

  int m = sz(vs);
  v(set<int>) s(m);
  rep(i,m) {
    int v = vs[i];
    for (int u : to[v]) {
      if (t[u]) continue;
      s[i].insert(gfs(u));
    }
  }

  // cerr<<vs<<endl;
  // rep(i,m) {
  //   for (int x : s[i]) cerr<<x<<endl;
  //   cerr<<"---"<<endl;
  // }

  vi c;
  for (int i = 0; sz(c) < 2; ++i) {
    if (s[0].count(i)) continue;
    c.pb(i);
  }
  s.pb(s[0]);
  for (int x0 : c) {
    int x = x0;
    rrep(i,m) {
      int j = 0;
      for (; j == x || s[i].count(j); ++j);
      x = j;
    }
    if (x == x0) {
      puts("POSSIBLE");
      return 0;
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}






















Measured memory_bytes: 38004