#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int n, a[200005], cnt[200005], q, curr;
bool f[200005];
set<int> pos[200005];
bool canReplace(int x) { return cnt[a[x]] > 1 && !f[x]; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    a[i]--;
    cnt[a[i]]++;
    pos[a[i]].insert(i);
  }
  for (int i = 0; i < n; i++)
    if (cnt[i] == 0) {
      q++;
      while (!canReplace(curr)) curr++;
      cnt[a[curr]]--;
      pos[a[curr]].erase(curr);
      a[curr] = i;
      f[curr] = true;
    } else {
      f[*pos[i].begin()] = true;
    }
  printf("%d\n", q);
  for (int i = 0; i < n; i++) printf("%d ", a[i] + 1);
  return 0;
}
