#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, arr[200001], ctr[200001];
  set<long int> s;
  vector<long int> s2;
  list<long int> s1;
  memset(ctr, 0, sizeof(ctr));
  cin >> n;
  for (long int i = 0; i < n; i++) {
    cin >> arr[i];
    s.insert(arr[i]);
    ctr[arr[i]]++;
  }
  if (s.size() == n) {
    cout << 0 << "\n";
    for (long int i = 0; i < n; i++) cout << arr[i] << " ";
    return 0;
  }
  for (long int i = 1; i <= n; i++) {
    if (!ctr[i]) s2.push_back(i);
  }
  sort(s2.begin(), s2.end());
  for (auto it : s2) {
    s1.push_back(it);
  }
  vector<bool> visited(n + 1, false);
  cout << s2.size() << "\n";
  for (long int i = 0; i < n; i++) {
    if (s1.size() == 0) break;
    if (ctr[arr[i]] > 1) {
      if (s1.front() < arr[i]) {
        ctr[arr[i]] = ctr[arr[i]] - 1;
        arr[i] = s1.front();
        s1.pop_front();
      } else if (s1.front() > arr[i] && visited[arr[i]] == false)
        visited[arr[i]] = true;
      else if (s1.front() > arr[i] && visited[arr[i]] == true) {
        ctr[arr[i]] = ctr[arr[i]] - 1;
        arr[i] = s1.front();
        s1.pop_front();
      }
    }
  }
  for (long int i = 0; i < n; i++) cout << arr[i] << " ";
}
