#include <bits/stdc++.h>
using namespace std;
int a[200006];
int cnt[200006] = {0};
bool taken[200009] = {0};
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], cnt[a[i]]++;
  stack<int> s;
  for (int i = n; i >= 1; i--)
    if (!cnt[i]) s.push(i);
  cout << s.size() << endl;
  for (int i = 1; i <= n; i++) {
    int k = a[i];
    if (taken[k]) {
      a[i] = s.top(), s.pop();
      continue;
    }
    if (cnt[k] > 1) {
      if (s.top() < k) {
        a[i] = s.top(), s.pop(), cnt[k]--;
        continue;
      } else
        taken[k] = 1;
    }
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << endl;
}
