#include <bits/stdc++.h>
using namespace std;
int n, ans, m;
queue<int> q;
int main() {
  cin >> n;
  int *a = new int[n + 1];
  int *j = new int[n + 1];
  memset(a, 0, sizeof(int) * (n + 1));
  for (int i = 1; i <= n; i++) {
    cin >> j[i];
    a[j[i]]++;
    if (a[j[i]] > 1) ans++;
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0) q.push(i);
  }
  for (int i = 1; i <= n; i++) {
    if (q.empty()) {
      cout << j[i] << " ";
    } else {
      if (a[j[i]] > 1) {
        if (j[i] < q.front()) {
          cout << j[i] << " ";
          a[j[i]] = 0;
        } else {
          a[j[i]]--;
          m = q.front();
          cout << m << " ";
          q.pop();
        }
      } else if (a[j[i]] == 1) {
        cout << j[i] << " ";
      } else {
        m = q.front();
        cout << m << " ";
        q.pop();
      }
    }
  }
  delete[] a;
  delete[] j;
  return 0;
}
