#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
int cnt[maxn];
int num[maxn];
int had[maxn];
int N;
int main() {
  memset(cnt, 0, sizeof(cnt));
  memset(had, 0, sizeof(had));
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &num[i]);
    cnt[num[i]]++;
  }
  int to = 1, ans = 0;
  for (int i = 1; i <= N; i++) {
    if (cnt[num[i]] != 1) {
      while (cnt[to] != 0) {
        to++;
      }
      if (to >= num[i] && !had[num[i]]) {
        had[num[i]] = 1;
        continue;
      }
      ans++;
      had[to] = 1;
      cnt[num[i]]--;
      num[i] = to;
      cnt[to] = 1;
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= N; i++) {
    printf("%d%c", num[i], i == N ? '\n' : ' ');
  }
  return 0;
}
