#include <bits/stdc++.h>
using namespace std;
int n, f[200005], a[200005], s[200005];
vector<int> have, need;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) {
    scanf("%d", &a[i]);
    f[a[i]]++;
    if (f[a[i]] > 1) have.push_back(a[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (f[i] == 0) need.push_back(i);
  }
  sort((need).begin(), (need).end());
  int p = 0;
  for (int i = 0; i < (int)(n); ++i) {
    if (f[a[i]] > 1) {
      if (a[i] < need[p] && s[a[i]] == 0) {
        s[a[i]] = 1;
        continue;
      }
      f[a[i]]--;
      a[i] = need[p];
      p++;
    }
  }
  printf("%d\n", (need).size());
  for (int i = 0; i < (int)(n); ++i) printf("%d ", a[i]);
  return 0;
}
