#include <bits/stdc++.h>
using namespace std;
int freq[200001];
int prev_freq[200001];
int arr[200001];
vector<int> v;
int main() {
  int n, counta = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
    freq[arr[i]]++;
  }
  int a = 1;
  for (int i = 1; i < 200001; ++i) {
    if (freq[a] == 0) {
      v.push_back(a);
    }
    a++;
  }
  a = 0;
  for (int i = 0; i < n; ++i) {
    int in_the_array = arr[i];
    if (freq[in_the_array] == 1) {
      continue;
    }
    if (freq[in_the_array] >= 2) {
      if (prev_freq[in_the_array] == 1) {
        arr[i] = v[a];
        a++;
        freq[in_the_array]--;
        counta++;
      } else {
        if (in_the_array < v[a]) {
          prev_freq[in_the_array] = 1;
        } else if (in_the_array == v[a]) {
          prev_freq[a] = 1;
          a++;
        } else if (in_the_array > v[a]) {
          arr[i] = v[a];
          a++;
          freq[in_the_array]--;
          counta++;
        }
      }
    }
  }
  cout << counta << "\n";
  for (int i = 0; i < n; ++i) {
    printf("%d ", arr[i]);
  }
}
