#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> p(n + 2);
  p[0] = -1;
  for (int i = 1; i < n + 1; i++) {
    std::cin >> p[i];
  }
  p[n + 1] = -1;
  int ans = 0;
  for (int i = 1; i < n + 1; i++) {
    if (p[i] == i) {
      std::cout << i << "\n";
      std::swap(p[i], p[i + 1]);
    }
  }
  std::cout << ans << "\n";
}
