#include <bits/stdc++.h>
using namespace std;
int const N = int(2e5) + 7;
int n;
int cnt[N], a[N];
vector<int> re;
bool occured[N];
void solve() {
  memset(cnt, 0, sizeof(cnt));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], cnt[a[i]]++;
  for (int i = 1; i < n + 1; i++) {
    if (!cnt[i]) re.push_back(i);
  }
  reverse(re.begin(), re.end());
  int ans = 0, with = 0;
  memset(occured, false, sizeof(occured));
  for (int i = 0; i < n; i++) {
    if (cnt[a[i]] == 1) continue;
    with = re.back();
    if (a[i] > with || occured[a[i]]) {
      cnt[a[i]]--;
      a[i] = with;
      cnt[a[i]]++;
      ans++;
      re.pop_back();
    }
    occured[a[i]] = true;
  }
  cout << ans << '\n';
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
int main() {
  solve();
  return 0;
}
