#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
int a[200005];
int cnt[200005];
bool isPrefix[200005];
vector<int> need;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cnt[i] = 0;
    isPrefix[i] = false;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cnt[a[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == 0) need.push_back(i);
  }
  int changes = 0;
  int id = 1;
  int pos = 0;
  while (pos < need.size() && id <= n) {
    while (cnt[a[id]] == 1 && id <= n) {
      id++;
    }
    if (need[pos] < a[id] || isPrefix[a[id]]) {
      cnt[a[id]]--;
      a[id] = need[pos];
      pos++;
    } else {
      isPrefix[a[id]] = true;
    }
    id++;
  }
  cout << need.size() << endl;
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
