#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 7;
int n, arr[M], d[M], b = 1, t = 0;
bool used[M];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    d[arr[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (d[arr[i]] > 1) {
      while (n >= b && d[b]) b++;
      if (arr[i] > b || used[arr[i]]) {
        t++;
        d[arr[i]]--;
        d[b]++;
        arr[i] = b;
      } else
        used[arr[i]] = 1;
    }
  }
  printf("%d\n", t);
  for (int i = 1; i <= n; i++) {
    printf("%d ", arr[i]);
  }
  return 0;
}
