#include <bits/stdc++.h>
using namespace std;
int a[200005];
int vis[200005] = {0};
int main() {
  int n, s = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
  }
  int j = 1;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      s++;
      while (j <= n) {
        if (vis[a[j]] > 1 || vis[a[j]] < 0) {
          if (i < a[j] || vis[a[j]] < 0) {
            vis[a[j]]--;
            a[j] = i;
            j++;
            break;
          }
          if (a[j] < i) {
            vis[a[j]] = -1;
          }
        }
        j++;
      }
    }
  }
  printf("%d\n", s);
  for (int i = 1; i <= n; i++) {
    if (i < n) {
      printf("%d ", a[i]);
    } else {
      printf("%d\n", a[i]);
    }
  }
  return 0;
}
