#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n + 1), b;
  map<int, int> f;
  for (int i = 1; i < n + 1; ++i) {
    cin >> a[i];
    f[a[i]]++;
  }
  for (int i = 1; i <= n; ++i) {
    if (f.find(i) == f.end()) b.push_back(i);
  }
  int ctt = 0;
  vector<int> ans;
  int j = 0, i;
  int flag = 0;
  map<int, int> done;
  if (b.size()) {
    flag = 1;
    for (i = 1; i <= n; ++i) {
      if (f[a[i]] > 1) {
        if (a[i] < b[j] && !done[a[i]]) {
          ans.push_back(a[i]);
          done[a[i]] = 1;
        } else {
          ans.push_back(b[j]);
          done[b[j]] = 1;
          j++;
          ctt++;
        }
        f[a[i]]--;
      } else if (f[a[i]] == 1) {
        if (done[a[i]]) {
          ans.push_back(b[j]);
          done[b[j]] = 1;
          j++;
          ctt++;
        } else {
          ans.push_back(a[i]);
          done[a[i]] = 1;
        }
      }
    }
  }
  if (!flag)
    for (int i = 1; i < n + 1; ++i) {
      ans.push_back(a[i]);
    }
  cout << ctt << endl;
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }
  return 0;
}
