#include <bits/stdc++.h>
using namespace std;
queue<int> needed;
int cnt[200100];
int placed[200100];
int main() {
  int n, a[200100];
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  for (int i = 1; i <= n; i++)
    if (!cnt[i]) needed.push(i);
  printf("%d\n", needed.size());
  for (int i = 1; i <= n; i++) {
    if (placed[a[i]]) {
      a[i] = needed.front();
      needed.pop();
    } else if (cnt[a[i]] == 1)
      continue;
    else {
      if (a[i] < needed.front())
        placed[a[i]] = 1;
      else {
        cnt[a[i]]--;
        a[i] = needed.front();
        needed.pop();
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d", a[i]);
    if (i != n)
      printf(" ");
    else
      printf("\n");
  }
}
