#include <bits/stdc++.h>
using namespace std;
int n;
const int MAXN = 200005;
int a[MAXN];
int counter[MAXN];
bool skip[MAXN];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    counter[a[i]]++;
  }
  int index = 1, ans = 0;
  for (int i = 1; i <= n; i++) {
    if (counter[a[i]] > 1) {
      while (counter[index] != 0) index++;
      if (index < a[i] || skip[a[i]]) {
        counter[a[i]]--;
        a[i] = index;
        ans++;
        counter[index]++;
      } else
        skip[a[i]] = true;
    }
  }
  cout << ans << "\n";
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << "\n";
  return 0;
}
