#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N], cnt[N], has[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ++cnt[a[i]];
  }
  int p = 1, ans = 0;
  for (int i = 1; i <= n; i++) {
    if (cnt[a[i]] > 1) {
      while (cnt[p] >= 1) p++;
      if (p < a[i] || has[a[i]]) {
        cnt[a[i]]--;
        a[i] = p;
        cnt[a[i]]++;
        ++ans;
      }
    }
    has[a[i]] = 1;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
