#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, a[maxn], have[maxn], cnt[maxn], ans[maxn], cp[maxn];
vector<int> need;
int main() {
  scanf("%d", &n);
  memset(cnt, 0, sizeof(cnt));
  memset(have, 0, sizeof(have));
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), cnt[a[i]]++, cp[i] = a[i];
  for (int i = 1; i <= n; i++)
    if (cnt[i] == 0) need.push_back(i);
  sort(need.begin(), need.end());
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    if (cnt[a[i]] == 1) continue;
    if (a[i] > need[pos] || have[a[i]] == 1) {
      cnt[a[i]]--;
      a[i] = need[pos];
      pos++;
    }
    if (a[i] < need[pos]) {
      have[a[i]] = 1;
      continue;
    }
  }
  int res = 0;
  for (int i = 1; i <= n; i++)
    if (cp[i] != a[i]) res++;
  printf("%d\n", res);
  for (int i = 1; i < n; i++) printf("%d ", a[i]);
  printf("%d\n", a[n]);
  return 0;
}
