#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

// Vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  s << "[";
	for (int i = 0; i < len; i++) {
    if (i > 0) s << ", ";
		s << v[i];
  }
  s << "]";
  return s;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  
  vector<vector<Edge>> d_graph(n);
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    p--;
    d_graph[p].push_back(Edge(p, i));
  }

  vector<vector<Edge>> u_graph(n);
  for (int v = 0; v < n; v++) {
    for (const auto& e : d_graph[v]) {
      u_graph[e.from].push_back(Edge(e.from, e.to));
      u_graph[e.to].push_back(Edge(e.to, e.from));
    }
  }

  auto find_cycle_fn = [&]() -> vector<int> {
    vector<int> degrees(n);
    for (int v = 0; v < n; v++) {
      degrees[v] = u_graph[v].size();
    }
    deque<int> q;
    for (int v = 0; v < n; v++) {
      if (degrees[v] == 1) {
        q.push_back(v);
      }
    }

    while (!q.empty()) {
      int v = q.front();
      q.pop_front();

      for (const auto& e : u_graph[v]) {
        if (degrees[e.to] > 0) {
          degrees[v]--;
          degrees[e.to]--;
          if (degrees[e.to] == 1) q.push_back(e.to);
        }
      }
    }

    vector<int> cycle;
    for (int v = 0; v < n; v++) {
      if (degrees[v] > 0) {
        cycle.push_back(v);
        int v1 = v;
        while (true) {
          int v2 = -1;
          for (const auto& e : d_graph[v1]) {
            if (degrees[e.to] > 0) {
              v2 = e.to;
              break;
            }
          }
          if (v2 < 0) {
            cerr << "Unexpected!" << endl;
            exit(1);
          }
          if (v2 == v) {
            return cycle;
          }
          cycle.push_back(v2);
          v1 = v2;
        }
      }
    }
    cerr << "Unexpected!" << endl;
    exit(1);
  };

  vector<int> cycle = find_cycle_fn();
  if (DEBUG) cout << "cycle: " << cycle << endl;

  vector<int> in_cycle(n, 0);
  for (int v : cycle) in_cycle[v] = 1;

  vector<int> gs(n, -1);
  function<void(int)> dfs_fn = [&](int v) {
    if (gs[v] >= 0) return;

    if (d_graph[v].size() == 0) {
      gs[v] = 0;
      return;
    }

    set<int> s;
    for (const auto& e : d_graph[v]) {
      dfs_fn(e.to);
      s.insert(gs[e.to]);
    }

    int count = 0;
    while (true) {
      if (s.find(count) == s.end()) {
        gs[v] = count;
        return;
      }
      count++;
    }
  };

  for (int v = 0; v < n; v++) {
    if (!in_cycle[v]) {
      dfs_fn(v);
    }
  }

  // Case 1
  auto check_1_fn = [&]() -> bool {
    vector<int> hs(gs.begin(), gs.end());

    for (int i = cycle.size() - 1; i >= 0; i--) {
      int v = cycle[i];
      set<int> s;
      for (const auto& e : d_graph[v]) {
        if (hs[e.to]>= 0) s.insert(hs[e.to]);
      }
      
      int c = 0;
      while (true) {
        if (s.find(c) == s.end()) {
          hs[v] = c;
          break;
        }
        c++;
      }
    }

    // Check
    if (hs[cycle[cycle.size() - 1]] == hs[cycle[0]]) return false;
    return true;
  };

  // Case 2
  auto check_2_fn = [&]() -> bool {
    vector<int> hs(gs.begin(), gs.end());

    {
      int v = cycle[cycle.size() - 1];
      set<int> s;
      for (const auto& e : d_graph[v]) {
        if (hs[e.to]>= 0) s.insert(hs[e.to]);
      }

      int c = 0;
      bool skipped = false;
      while (true) {
        if (s.find(c) == s.end()) {
          if (!skipped) {
            skipped = true;
          } else {
            hs[v] = c;
            break;
          }
        }
        c++;
      }
    }

    for (int i = cycle.size() - 2; i >= 0; i--) {
      int v = cycle[i];
      set<int> s;
      for (const auto& e : d_graph[v]) {
        if (hs[e.to]>= 0) s.insert(hs[e.to]);
      }
      
      int c = 0;
      while (true) {
        if (s.find(c) == s.end()) {
          hs[v] = c;
          break;
        }
        c++;
      }
    }

    // Check
    if (hs[cycle[cycle.size() - 1]] == hs[cycle[0]]) return false;

    set<int> s;
    for (const auto& e : d_graph[cycle[cycle.size() - 1]]) {
      if (hs[e.to]>= 0) s.insert(hs[e.to]);
    }

    for (int i = 0; i < hs[cycle[cycle.size() - 1]]; i++) {
      if (s.find(i) == s.end()) return false;
    }
    return true;
  };

  bool ans = check_1_fn() || check_2_fn();
  cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 24248