#include <bits/stdc++.h>
using namespace std;
int a[200001];
int b[200000];
int c[200001];
int main() {
  int n, i, j;
  cin >> n;
  map<int, int> m;
  for (i = 0; i < n; i++) {
    cin >> b[i];
    m[b[i]]++;
    a[b[i]] = 1;
  }
  vector<int> v;
  for (i = 1; i <= n; i++) {
    if (a[i] == 0) {
      v.push_back(i);
    }
  }
  sort(v.begin(), v.end());
  cout << v.size() << endl;
  int p = 0;
  for (i = 0; i < n; i++) {
    if (c[b[i]] == 1) {
      cout << v[p] << " ";
      p++;
      c[b[i]] = 1;
      m[b[i]]--;
    } else {
      if (m[b[i]] == 1) {
        cout << b[i] << " ";
      } else if (m[b[i]] > 1) {
        if (v[p] < b[i]) {
          cout << v[p] << " ";
          m[b[i]]--;
          p++;
        } else {
          cout << b[i] << " ";
          c[b[i]] = 1;
          m[b[i]]--;
        }
      }
    }
  }
  return 0;
}
