#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  vector<vector<int>> v(n + 1);
  for (int i = 0; i < n; ++i) v[a[i]].push_back(i);
  vector<int> need;
  for (int i = 1; i <= n; ++i)
    if (v[i].size() == 0) need.push_back(i);
  sort(need.begin(), need.end());
  int p = 0;
  vector<bool> m(n + 1, false);
  for (int i = 0; i < need.size(); ++i) {
    int k = need[i];
    while (v[a[p]].size() <= 1) ++p;
    if (k < a[p]) {
      v[a[p]].pop_back();
      a[p] = k;
      ++p;
    } else {
      if (!m[a[p]]) {
        m[a[p]] = true;
        --i;
        ++p;
      } else {
        v[a[p]].pop_back();
        a[p] = k;
        ++p;
      }
    }
  }
  cout << need.size() << "\n";
  for (auto i : a) cout << i << " ";
  return 0;
}
