#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[200001];
bool used[200001];
long long cnt[200001];
long long md[200001], mc, pos;
int main() {
  scanf("%lld", &n);
  for (register long long i = 0; i < n; ++i) scanf("%lld", a + i), ++cnt[a[i]];
  for (register long long i = 1; i <= n; ++i)
    if (!cnt[i]) md[mc++] = i;
  for (register long long i = 0; i < n; ++i)
    if (pos < mc && cnt[a[i]] > 1 && (a[i] > md[pos] || used[a[i]]))
      --cnt[a[i]], a[i] = md[pos++];
    else
      used[a[i]] = true;
  printf("%lld\n", mc);
  for (register long long i = 0; i < n; ++i) printf("%lld ", a[i]);
  putc('\n', stdout);
  return 0;
}
