#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  int freq[1000010] = {0};
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    freq[v[i]]++;
  }
  vector<int> a;
  for (int i = 1; i <= n; i++)
    if (freq[i] == 0) a.push_back(i);
  int j = 0;
  int vis[1000010] = {0};
  for (int i = 0; i < n; i++) {
    if (j >= a.size()) break;
    if (freq[v[i]] >= 2) {
      if (v[i] > a[j] || vis[v[i]]) {
        freq[v[i]]--;
        v[i] = a[j];
        j++;
      } else
        vis[v[i]] = 1;
    }
  }
  cout << a.size() << endl;
  for (int i = 0; i < n; i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
