#include <bits/stdc++.h>
int n, a[200007], b[200007], ans, it = 1, was[200007];
int main() {
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
    ++b[a[i]];
  }
  for (int i = 0; i < n; ++i) {
    if (b[a[i]] != 1) {
      while (b[it]) ++it;
      if (it < a[i] || was[a[i]]) {
        ++ans;
        --b[a[i]];
        ++b[it];
        a[i] = it;
      } else {
        was[a[i]] = true;
      }
    }
  }
  std::cout << ans << "\n";
  for (int i = 0; i < n; ++i) {
    std::cout << a[i] << " ";
  }
}
