#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005];
bool check[200005];
int main() {
  int n, i, c, k = 1;
  cin >> n;
  memset(a, 0, sizeof(a));
  memset(check, false, sizeof(check));
  for (i = 1; i <= n; i++) {
    cin >> c;
    b[i] = c;
    ++a[b[i]];
  }
  c = 0;
  for (i = 1; i <= n; i++) {
    while (a[k]) {
      ++k;
    }
    if (a[b[i]] > 1 && (k < b[i] || check[b[i]])) {
      --a[b[i]];
      b[i] = k;
      ++k;
      ++c;
    }
    check[b[i]] = true;
  }
  cout << c << endl;
  for (i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
