#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int>> pq;
int n;
int a[200010];
int cnt[200010];
int scnt[200010];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    cnt[a[i]]++;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == 0) pq.push(i);
  }
  ans = pq.size();
  for (int i = 0; i < n; i++) {
    if (cnt[a[i]] > 1) {
      if (pq.top() < a[i] || scnt[a[i]] == 1) {
        cnt[a[i]]--;
        a[i] = pq.top();
        pq.pop();
      }
    }
    scnt[a[i]]++;
  }
  printf("%d\n", ans);
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
}
