#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> num(N + 1), fix(N + 1);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    num[A[i]]++;
  }
  set<int> avail;
  for (int i = 1; i <= N; i++)
    if (num[i] == 0) avail.insert(i);
  int op = avail.size();
  for (int i = 0; i < N; i++) {
    if (num[A[i]] == 1) continue;
    if (avail.size() && (*avail.begin() < A[i] || fix[A[i]])) {
      num[A[i]]--;
      A[i] = *avail.begin();
      avail.erase(A[i]);
    }
    fix[A[i]] = 1;
  }
  cout << op << endl;
  for (int a : A) cout << a << " ";
  cout << endl;
  return 0;
}
