#include <bits/stdc++.h>
using namespace std;
void dk_98() {}
long long power(long long x, long long y, long long p = 1) {
  long long res = 1LL;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
void solve() {
  int n;
  cin >> n;
  int arr[n];
  int mapp[200002] = {0};
  for (int i = 0; i < (int)(n); i++) {
    cin >> arr[i];
    mapp[arr[i]]++;
  }
  vector<int> vec;
  for (int i = 1; i <= (int)(n); i++) {
    if (mapp[i] == 0) vec.push_back(i);
  }
  int cnt = 0;
  int j = 0;
  vector<bool> pref(n + 1, false);
  for (int i = 0; i < (int)(n); i++) {
    if (mapp[arr[i]] > 1 and (vec[j] < arr[i] or pref[arr[i]])) {
      mapp[arr[i]]--;
      arr[i] = vec[j];
      cnt++;
      j++;
    } else if (mapp[arr[i]] > 1) {
      pref[arr[i]] = true;
    }
    if (cnt == vec.size()) break;
  }
  cout << cnt << "\n";
  for (int i = 0; i < (int)(n); i++) {
    cout << arr[i] << " ";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  dk_98();
  int t = 1;
  while (t--) {
    solve();
  }
}
