#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> rep(n + 1);
  vector<int> le(n + 1);
  map<int, int> ct;
  int pres = n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v[i] = x;
    rep[x]++;
    ct[x]++;
  }
  int nxt = 1, sw = 0;
  for (int i = 0; i < n; i++) {
    while (rep[nxt]) nxt++;
    int x = v[i];
    if (rep[x] >= 2 && nxt < x && ct[x] > 1 || le[x]) {
      ct[x]--;
      v[i] = nxt;
      rep[nxt]++;
      sw++;
    } else {
      le[x] = 1;
    }
  }
  cout << sw << endl;
  for (auto x : v) cout << x << " ";
  return 0;
}
