#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  vector<int> c;
  for (int i = 0; i < n; i++) a[i] = 0;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    c.push_back(k);
    a[k - 1] += 1;
  }
  queue<int> q;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      q.push(i + 1);
      ans++;
    }
  }
  bool done[n];
  for (int i = 0; i < n; i++) done[i] = 0;
  for (int i = 0; i < n; i++) {
    if (q.empty()) break;
    if (done[c[i] - 1] == 1) {
      a[c[i] - 1]--;
      c[i] = q.front();
      q.pop();
    } else {
      if (a[c[i] - 1] == 1) {
        done[c[i] - 1] = 1;
        a[c[i] - 1]--;
      } else if (q.front() > c[i]) {
        done[c[i] - 1] = 1;
        a[c[i] - 1]--;
      } else {
        a[c[i] - 1]--;
        c[i] = q.front();
        q.pop();
      }
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << c[i] << " ";
  return 0;
}
