#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> cnt(n + 1), occ(n + 1), a(n), need;
  for (int i = 0; i < n; ++i) cin >> a[i], cnt[a[i]]++;
  for (int i = 1; i <= n; ++i)
    if (!cnt[i]) need.push_back(i);
  size_t pos = 0, ans = 0;
  for (int i = 0; i < n; occ[a[i++]] = 1)
    if (cnt[a[i]] != 1 && pos < need.size() &&
        (a[i] > need[pos] || occ[a[i]])) {
      cnt[a[i]]--;
      a[i] = need[pos++];
      ans++;
    }
  cout << ans << '\n';
  for (const int &x : a) cout << x << ' ';
  cout << '\n';
  return 0;
}
