#include <iostream>
using namespace std;
int main() {
int n, howMany = 0, j = 1;
int v[10], samePosition[10];
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
for (int i = 1; i <= n; ++i) {
if (v[i] == i) {
samePosition[j] = v[i];
++j;
++howMany;
}
}
for (int i = 1; i <= howMany; ++i) {
cout << samePosition[i] << " ";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiwgaG93TWFueSA9IDAsIGogPSAxOwoJaW50IHZbMTBdLCBzYW1lUG9zaXRpb25bMTBdOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CgkJY2luID4+IHZbaV07Cgl9Cglmb3IgKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKCQlpZiAodltpXSA9PSBpKSB7CgkJCXNhbWVQb3NpdGlvbltqXSA9IHZbaV07CgkJCSsrajsKCQkJKytob3dNYW55OwoJCX0KCX0KCWZvciAoaW50IGkgPSAxOyBpIDw9IGhvd01hbnk7ICsraSkgewoJCWNvdXQgPDwgc2FtZVBvc2l0aW9uW2ldIDw8ICIgIjsKCX0KCXJldHVybiAwOwp9