#include <bits/stdc++.h>
using namespace std;
int main() {
  std::cin.tie();
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int ch[n + 1];
  memset(ch, 0, sizeof ch);
  int a[n];
  bool done[n + 1];
  memset(done, 0, sizeof ch);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ch[a[i]]++;
    ;
  }
  queue<int> q;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!ch[i])
      q.push(i);
    else
      ans += ch[i] - 1;
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    if (q.empty()) break;
    if (done[a[i]]) {
      a[i] = q.front();
      q.pop();
      continue;
    }
    if (ch[a[i]] == 1) continue;
    if (a[i] < q.front())
      done[a[i]] = 1;
    else {
      ch[a[i]]--;
      a[i] = q.front();
      q.pop();
    }
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
