#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, ans = 0;
  cin >> n;
  vector<int> A(n), App(n + 1, 0);
  vector<bool> Not_changed(n + 1, true);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    App[A[i]]++;
  }
  queue<int> Q;
  for (int i = 1; i <= n; i++)
    if (App[i] == 0) {
      Q.push(i);
      ans++;
    }
  Q.push((1 << 30));
  for (int i = 0; i < n; i++)
    if (App[A[i]] > 1) {
      if (!Not_changed[A[i]] || Q.front() < A[i]) {
        App[A[i]]--;
        A[i] = Q.front();
        Q.pop();
      } else
        Not_changed[A[i]] = false;
    }
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << A[i] << " ";
  cout << endl;
  return 0;
}
