#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793238463;
int f[200009];
bool vis[200009];
int a[200009];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    f[a[i]]++;
  }
  set<int> s;
  for (int x = 1; x <= n; x++)
    if (!f[x]) s.insert(x);
  cout << (int)s.size() << '\n';
  for (int i = 0; i < (n); i++) {
    f[a[i]]--;
    if (!f[a[i]] && !vis[a[i]]) continue;
    if (vis[a[i]] || *(s.begin()) < a[i]) {
      a[i] = *(s.begin());
      s.erase(s.begin());
    } else
      vis[a[i]] = 1;
  }
  for (int i = 0; i < (n); i++) cout << a[i] << " ";
  cout << '\n';
  return 0;
}
