#include <bits/stdc++.h>
using namespace std;
int sequence[200000 + 1];
int counter[200000 + 1];
bool is_placed[200000 + 1];
int n;
void read() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> sequence[i];
    counter[sequence[i]]++;
  }
}
void answer() {
  priority_queue<int, vector<int>, greater<int> > que;
  for (int i = 1; i <= n; ++i) {
    if (counter[i] == 0) {
      que.push(i);
    }
  }
  int op = 0;
  for (int i = 0; i < n; ++i) {
    int my = sequence[i];
    if (counter[my] > 1 && (que.top() < my || is_placed[my])) {
      counter[my]--;
      sequence[i] = que.top();
      que.pop();
      op++;
    }
    is_placed[sequence[i]] = true;
  }
  cout << op << endl;
  for (int i = 0; i < n; ++i) {
    cout << sequence[i] << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  read();
  answer();
  return 0;
}
