#include <bits/stdc++.h>
using namespace std;
const long long INF = 3e18 + 100;
const int MOD = 1e9 + 7;
const int N = 100;
int32_t main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n;
  cin >> n;
  set<int> s, tot;
  vector<int> a(n + 5, 0), cnt(n + 5, 0), last(n + 5);
  vector<bool> ok(n + 4, true);
  for (int i = 1; i <= n; ++i) {
    s.insert(i);
  }
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
    tot.insert(a[i]);
    if (s.find(a[i]) != s.end()) {
      s.erase(a[i]);
    }
  }
  cout << n - tot.size() << endl;
  for (int i = 1; i <= n; ++i) {
    if (cnt[a[i]] == 1) continue;
    if (ok[a[i]] and *s.begin() > a[i]) {
      ok[a[i]] = false;
    } else {
      cnt[a[i]]--;
      a[i] = *s.begin();
      s.erase(s.begin());
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << a[i] << " ";
  }
  return 0;
}
