#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int cnt[n + 1];
  bool placedBefore[n + 1];
  queue<int> q;
  int minMoves = 0;
  memset(cnt, 0, sizeof(cnt));
  memset(placedBefore, false, sizeof(placedBefore));
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    cnt[arr[i]] += 1;
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == 0) {
      minMoves += 1;
      q.push(i);
    }
  }
  for (int i = 0; i < n; i++) {
    if (cnt[arr[i]] >= 1) {
      if (!q.empty()) {
        if (q.front() < arr[i]) {
          if (placedBefore[arr[i]]) {
            cnt[arr[i]] -= 1;
            arr[i] = q.front();
            placedBefore[q.front()] = true;
            cnt[q.front()] += 1;
            q.pop();
          } else {
            if (cnt[arr[i]] > 1) {
              cnt[arr[i]] -= 1;
              arr[i] = q.front();
              placedBefore[q.front()] = true;
              cnt[q.front()] += 1;
              q.pop();
            } else {
              placedBefore[arr[i]] = true;
              cnt[arr[i]] -= 1;
            }
          }
        } else {
          if (placedBefore[arr[i]]) {
            arr[i] = q.front();
            cnt[q.front()] += 1;
            placedBefore[q.front()] = true;
            q.pop();
          } else {
            placedBefore[arr[i]] = true;
            cnt[arr[i]] -= 1;
          }
        }
      } else {
        placedBefore[arr[i]] = true;
      }
    } else {
      placedBefore[arr[i]] = true;
    }
  }
  cout << minMoves << endl;
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  return 0;
}
