#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), us(n + 1, 0), don(n + 1, 0), fre(n + 1, 0);
  int cnt = 1, ans = 0;
  for (int i = 0; i < n; ++i) cin >> a[i], fre[a[i]]++, us[a[i]] = 1;
  for (int i = 0; i < n; ++i) {
    if (fre[a[i]] == 1 && !don[a[i]]) continue;
    while (us[cnt]) cnt++;
    if (!don[a[i]] && cnt > a[i])
      don[a[i]] = 1;
    else
      fre[a[i]]--, a[i] = cnt, us[cnt] = 1, ans++;
  }
  cout << ans << '\n';
  for (auto i : a) cout << i << " ";
}
