#include <bits/stdc++.h>
using namespace std;
int a[200020], f[200020], ap[200020];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, rem = 0;
  cin >> n;
  set<int> s, rep;
  for (int i = int(1); i < int(n + 1); ++i) s.insert(i);
  for (int i = int(0); i < int(n); ++i) {
    cin >> a[i];
    s.erase(a[i]);
    f[a[i]]++;
    if (f[a[i]] >= 2) rep.insert(a[i]);
  }
  int ans = int(s.size()), cur = 0, cont = 0;
  vector<int> vec;
  for (int x : s) vec.push_back(x);
  for (int i = 0; i < n and cur != int(vec.size()); ++i) {
    if (f[a[i]] == 1) continue;
    if (vec[cur] < a[i]) {
      f[a[i]]--;
      a[i] = vec[cur++];
    } else if (ap[a[i]]) {
      f[a[i]]--;
      a[i] = vec[cur++];
    }
    ap[a[i]] = 1;
  }
  cout << ans << endl;
  for (int i = int(0); i < int(n); ++i) cout << a[i] << " ";
  cout << endl;
  return 0;
}
