#include <bits/stdc++.h>
using namespace std;
const int N = 200006;
struct node {
  int x, f;
} a[N];
int b[N], c[N];
int n, s;
void work(void) {
  int i, j;
  i = 1;
  j = 1;
  while (a[b[i]].x == 1 && i <= n) {
    c[i] = b[i];
    i++;
  }
  while (a[j].x > 0 && j <= n) j++;
  while (i <= n) {
    if (j < b[i] || a[b[i]].f == 1) {
      c[i] = j;
      a[b[i]].x--;
      s++;
      j++;
      while (a[j].x > 0 && j <= n) j++;
    } else {
      c[i] = b[i];
      a[b[i]].f = 1;
    }
    i++;
    while (a[b[i]].x == 1 && i <= n) {
      c[i] = b[i];
      i++;
    }
  }
  cout << s << endl;
  for (i = 1; i <= n; i++) cout << c[i] << " ";
}
int main(void) {
  int i;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> b[i];
    a[b[i]].x++;
  }
  work();
  return 0;
}
