#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int g;

int func(int p[], int c, bool chk[]) {
  if (chk[p[c]]) {
    return c;
  }

  chk[p[c]] = true;
  return func(p, p[c], chk);
}

int dfs(vector<int> v[], int c, int r, int a[], bool flag) {
  if (v[c].size() == 0) {
    a[c] = 0;
    return 0;
  }

  vector<int> pool;
  bool has = false;
  for (int i = 0; i < v[c].size(); i++) {
    if (v[c][i] == r) {
      has = true;
    } else {
      pool.push_back(dfs(v, v[c][i], r, a, flag));
    }
  }
  sort(pool.begin(), pool.end());
  unique(pool.begin(), pool.end());
  for (int i = 0; i < pool.size(); i++) {
    if (pool[i] != i) {
      if (has && flag) {
        has = false;
        g = i;
        pool.push_back(i);
        sort(pool.begin(), pool.end());
        continue;
      }
      a[c] = i;
      return i;
    }
  }

  int ret = has && flag ? pool.size() + 1 : pool.size();
  if (has && flag)
    g = pool.size();

  a[c] = ret;
  return ret;
}

int main() {
  int N;
  int p[200000];
  vector<int> v[200000];

  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
    v[--p[i]].push_back(i);
  }

  bool chk[200000];
  for (int i = 0; i < N; i++) {
    chk[i] = false;
  }
  chk[0] = true;
  int r = func(p, 0, chk);

  int a[200000];
  int a1 = dfs(v, r, r, a, false);
  if (a[p[r]] != a1) {
    cout << "POSSIBLE" << endl;
    return 0;
  }

  int a2 = dfs(v, r, r, a, true);
  if (a[p[r]] != a2 && g == a2) {
    cout << "POSSIBLE" << endl;
    return 0;
  }

  cout << "IMPOSSIBLE" << endl;
  return 0;
}
