#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long, long long> p, l;
  long long n, a[200000], i, k = 0, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    p[a[i]]++;
  }
  j = 1;
  for (i = 0; i < n; i++) {
    while (p[j] != 0) {
      j++;
    }
    if (p[a[i]] > 1) {
      if (l[a[i]] == 1 || a[i] > j) {
        p[a[i]]--;
        a[i] = j;
        j++;
        k++;
      } else {
        l[a[i]] = 1;
      }
    }
  }
  cout << k << endl;
  for (i = 0; i < n; i++) cout << a[i] << " ";
}
