#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<int> H(N + 1, 0), T(N + 1, 1);
  for (int i = 0; i < N; i++) H[A[i]]++;
  int j = 1;
  int Ans = 0;
  for (int i = 0; i < N; i++) {
    if (H[A[i]] != 1) {
      while (j <= N) {
        if (H[j] == 0) {
          break;
        }
        j++;
      }
      if (j > N) break;
      if (j < A[i] || T[A[i]] == 0) {
        H[A[i]]--;
        A[i] = j;
        H[j] = 1;
        Ans++;
      } else
        T[A[i]]--;
    }
  }
  cout << Ans << endl;
  for (int i = 0; i < N; i++) cout << A[i] << " ";
}
