#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 2e5 + 5;
int a[maxn], lst[maxn];
bool used[maxn];
int occ[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int ans = n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    lst[a[i]] = i;
    if (occ[a[i]] == 0) ans--;
    occ[a[i]]++;
  }
  cout << ans << '\n';
  int j = 1;
  for (int i = 1; i <= n; i++) {
    if (!used[a[i]] && (a[i] < j || lst[a[i]] == i)) {
      used[a[i]] = true;
      cout << a[i] << ' ';
    } else {
      while ((j != a[i] && occ[j] > 0) || occ[j] == 1 || used[j]) j++;
      used[j] = true;
      cout << j << ' ';
    }
  }
  cout << '\n';
  return 0;
}
