#include <bits/stdc++.h>
using namespace std;
long long a[200005];
unordered_map<long long, long long> f, done;
vector<long long> v;
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  long long ans = 0;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    f[a[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (f[i] == 0) {
      ans++;
      v.push_back(i);
    }
  }
  cout << ans << endl;
  long long ptr = 0;
  for (long long i = 1; i <= n; i++) {
    if (f[a[i]] == 1) {
      if (done[a[i]] == 0) {
        cout << a[i] << " ";
        done[a[i]]++;
      } else {
        cout << v[ptr] << " ";
        ptr++;
      }
    } else {
      if (v[ptr] > a[i] && done[a[i]] == 0) {
        cout << a[i] << " ";
        f[a[i]]--;
        done[a[i]]++;
      } else {
        f[a[i]]--;
        cout << v[ptr] << " ";
        done[v[ptr]]++;
        ptr++;
      }
    }
  }
}
