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