#include <bits/stdc++.h>
using namespace std;
int n, a[200020], t[200020], f[200020], fix[200020];
vector<int> idx[200020];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) t[i] = 2e9;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    ++f[a[i]];
  }
  vector<int> r;
  for (int i = 1; i <= n; ++i)
    if (f[i] == 0) r.push_back(i);
  reverse(r.begin(), r.end());
  int ans = r.size();
  for (int i = 1; i <= n; ++i) {
    if (f[a[i]] == 1) {
      continue;
    }
    if (fix[a[i]] || f[a[i]] > 1) {
      if (!fix[a[i]] && a[i] < r.back()) {
        fix[a[i]] = 1;
        continue;
      }
      --f[a[i]];
      a[i] = r.back();
      r.pop_back();
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i) printf("%d ", a[i]);
  return 0;
}
