#include <bits/stdc++.h>
using namespace std;
int n, a[200005], first[200005], ans;
map<int, int> mp;
set<int> missing, found;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) missing.insert(i);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mp[a[i]]++;
    if (!first[a[i]]) first[a[i]] = i;
    missing.erase(a[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (mp[a[i]] == 1) {
      found.insert(a[i]);
      continue;
    }
    if (*missing.begin() < a[i] || found.count(a[i])) {
      mp[a[i]]--;
      a[i] = *missing.begin();
      missing.erase(a[i]);
      ans++;
    }
    found.insert(a[i]);
  }
  cout << ans << '\n';
  for (int i = 1; i <= n; i++) cout << a[i] << ' ';
}
