#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  set<long long int> s;
  long long int last[n + 1];
  memset(last, -1, sizeof(last));
  for (long long int i = 1; i <= n; i++) {
    s.insert(i);
  }
  long long int a[n];
  unordered_map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    last[a[i]] = i;
    mp[a[i]]++;
    if (s.find(a[i]) != s.end()) {
      s.erase(a[i]);
    }
  }
  long long int op = 0;
  auto it = s.begin();
  bool occured[n + 1];
  memset(occured, false, sizeof(occured));
  for (long long int i = 0; i < n; i++) {
    if (it != s.end()) {
      if (mp[a[i]] > 1) {
        if ((*it) < a[i]) {
          mp[a[i]]--;
          a[i] = (*it);
          op++;
          it = next(it);
        } else if (occured[a[i]] == false) {
          occured[a[i]] = true;
        } else if (occured[a[i]]) {
          mp[a[i]]--;
          a[i] = (*it);
          op++;
          it = next(it);
        }
      }
    }
  }
  cout << op << endl;
  for (long long int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
