#include <bits/stdc++.h>
using namespace std;
long long n, i, j, k, l = 0, first, a[200005], b[200005], c[200005] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  set<long long> second;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (c[a[i]] == 0) j++;
    c[a[i]]++;
  }
  cout << n - j << endl;
  if (j == n) {
    for (i = 0; i < n; i++) cout << a[i] << " ";
    return 0;
  }
  for (i = 0; i < n; i++) {
    b[a[i]] = i;
  }
  vector<long long> v;
  for (i = 1; i <= n; i++) {
    if (!c[i]) v.push_back(i);
  }
  k = 0;
  long long must[200005] = {0};
  for (i = 0; i < n && k < v.size(); i++) {
    if (a[i] > v[k] && b[a[i]] != i || must[a[i]])
      a[i] = v[k], k++;
    else
      must[a[i]] = 1;
  }
  for (i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
