#include <bits/stdc++.h>
using namespace std;
int a[202020], f[202020];
int s[202020];
bool br[202020];
int n, doe, ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), ++f[a[i]];
  doe = 1;
  while (f[doe] != 0) ++doe;
  for (int i = 1; i <= n; ++i) {
    if (f[a[i]] == 1 && br[a[i]] == 0) {
      s[i] = a[i];
      br[a[i]] = 1;
      continue;
    }
    if (a[i] < doe && br[a[i]] == 0) {
      s[i] = a[i];
      br[a[i]] = 1;
      --f[a[i]];
      continue;
    }
    ++ans;
    s[i] = doe;
    --f[a[i]];
    br[doe] = 1;
    ++doe;
    while (f[doe] != 0) ++doe;
  }
  printf("%d\n", ans);
  printf("%d", s[1]);
  for (int i = 2; i <= n; ++i) printf(" %d", s[i]);
  printf("\n");
  return 0;
}
