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

void dfs(const int nd, const vector< vector<int> > &adj,
         vector<int> &dp, vector<int> &state)
{
  state[nd] = 1;

  // Leaf
  if (adj[nd].size() == 0) {
    dp[nd] = 0;
    state[nd] = 2;
    return;
  }

  // Calculating Child Nodes
  for (int ind = 0; ind < (int)adj[nd].size(); ++ind) {
    int child_nd = adj[nd][ind];
    if (state[child_nd] == 2) continue;
    if (state[child_nd] == 1) continue; // XXX
    dfs(child_nd, adj, dp, state);
  }

  // Determining Value of "nd"
  set<int> child_values;
  for (int ind = 0; ind < (int)adj[nd].size(); ++ind) {
    int child_nd = adj[nd][ind];
    if (dp[child_nd] == -1) {
      state[nd] = 2;
      return;
    }
    child_values.insert(dp[child_nd]);
  }
  int v = 0;
  while (true) {
    if (!child_values.count(v)) break;
    ++v;
  }
  dp[nd] = v;

  state[nd] = 2;
}

void print_adjacency_list(const vector< vector<int> > adj)
{
  for (int st_nd = 0; st_nd < (int)adj.size(); ++st_nd) {
    cout << st_nd << ": ";
    for (int ind = 0; ind < (int)adj[st_nd].size(); ++ind) {
      int ed_nd = adj[st_nd][ind];
      cout << ed_nd << ", ";
    }
    cout << endl;
  }
}

int main(int argc, char **argv)
{
  // Getting Input Data
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; ++i) {
    cin >> p[i];
    --p[i];
  }

  // Making Adjacency List
  vector< vector<int> > adj(N);
  for (int nd = 0; nd < N; ++nd) {
    adj[p[nd]].push_back(nd);
  }

  // Pre-Calculation by DFS
  vector<int> state(N, 0);
  vector<int> dp(N, -1);
  for (int nd = 0; nd < N; ++nd) {
    dfs(nd, adj, dp, state);
  }

  // Getting Target Node and Candidates
  int trgt_nd = 0;
  int val = dp[trgt_nd];
  while (val != -1) {
    ++trgt_nd;
    val = dp[trgt_nd];
  }
  set<int> candidates;
  for (int i = 0; i <= (int)adj[trgt_nd].size(); ++i) {
    candidates.insert(i);
  }
  for (int ind = 0; ind < (int)adj[trgt_nd].size(); ++ind) {
    int child_val = dp[adj[trgt_nd][ind]];
    if (child_val != -1) {
      candidates.erase(child_val);
    }
  }

  // Making Predecessor
  int next_nd;
  int crrnt_nd = trgt_nd;
  vector<int> pred(N);
  while (true) {
    for (int i = 0; i < (int)adj[crrnt_nd].size(); ++i) {
      int child_nd = adj[crrnt_nd][i];
      if (dp[child_nd] == -1) {
        next_nd = child_nd;
        break;
      }
    }
    pred[next_nd] = crrnt_nd;
    if (next_nd == trgt_nd) {
      break;
    }
    crrnt_nd = next_nd;
  }

  // Checking Candidates
  for (auto itr = candidates.begin(); itr != candidates.end(); ++itr) {
    int pre_nd = pred[trgt_nd];
    dp[trgt_nd] = *itr;
    while (pre_nd != trgt_nd) {
      // Determining Value of "pre_nd"
      set<int> child_values;
      for (int ind = 0; ind < (int)adj[pre_nd].size(); ++ind) {
        int child_nd = adj[pre_nd][ind];
        child_values.insert(dp[child_nd]);
      }
      int v = 0;
      while (true) {
        if (!child_values.count(v)) break;
        ++v;
      }
      dp[pre_nd] = v;
      pre_nd = pred[pre_nd];
    }
    // Final Check
    set<int> child_values;
    for (int ind = 0; ind < (int)adj[trgt_nd].size(); ++ind) {
      int child_nd = adj[trgt_nd][ind];
      child_values.insert(dp[child_nd]);
    }
    int v = 0;
    while (true) {
      if (!child_values.count(v)) break;
      ++v;
    }
    if (v == dp[trgt_nd]) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE";
  return 0;
}


Measured memory_bytes: 34048