#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<int> s;
  bool b[200009] = {0, 0, 0};
  for (int i = 0; i < n; ++i) s.insert(i + 1);
  int arr[200009] = {0, 0, 0}, a[200009];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    arr[a[i] - 1]++;
    if (arr[a[i] - 1] == 1) s.erase(s.find(a[i]));
  }
  int k = s.size();
  set<int>::iterator it = s.begin();
  for (int i = 0; i < n; i++) {
    it = s.begin();
    if (arr[a[i] - 1] > 1) {
      if (*it < a[i] || b[a[i] - 1])
        arr[a[i] - 1]--, a[i] = *it, s.erase(s.find(*it));
      else {
        b[a[i] - 1] = 1;
      }
    }
  }
  cout << k << endl;
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
}
