#include <bits/stdc++.h>
using namespace std;
int n;
set<int> pos[200000];
int a[200000];
int res[200000];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
    pos[a[i]].insert(i);
  }
  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (!pos[i].size()) cnt++;
  printf("%d\n", cnt);
  int cur = 0;
  while (pos[cur].size()) {
    cur++;
  }
  memset(res, -1, sizeof res);
  for (int i = 0; i < n; i++) {
    if (pos[a[i]].size() > 1) {
      if (cur < a[i] || *pos[a[i]].begin() != i) {
        res[i] = cur;
        pos[a[i]].erase(i);
        cur++;
        while (pos[cur].size()) {
          cur++;
        }
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (res[i] == -1) {
      res[i] = a[i];
    }
  for (int i = 0; i < n; i++) {
    printf("%d ", res[i] + 1);
  }
}
