#include <bits/stdc++.h>
using namespace std;
int i, ind, n, a[200005], fr[200005];
vector<int> v;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    fr[a[i]] = 1;
  }
  for (i = 1; i <= n; i++)
    if (!fr[i]) v.push_back(i);
  for (i = 1; i <= n; i++) {
    if (!a[i] && !fr[i]) {
      if (v[ind] == i) {
        v.push_back(v[ind]);
        ind++;
        a[i] = v[ind];
      } else
        a[i] = v[ind];
      ind++;
    }
  }
  for (i = 1; i <= n; i++) {
    if (a[i])
      cout << a[i] << ' ';
    else {
      cout << v[ind] << ' ';
      ind++;
    }
  }
  return 0;
}
