#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 200 * 1000 + 24, INF = (1 << 30);
int n;
int a[MAX_N], cnt[MAX_N], mark[MAX_N];
vector<int> G[MAX_N], vec, avb;
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--, cnt[a[i]]++;
  for (int i = 0; i < n; i++)
    if (cnt[i] == 0) vec.push_back(i);
  for (int i = 0; i < n; i++) {
    if (cnt[a[i]] > 1) {
      G[a[i]].push_back(i), avb.push_back(i);
      mark[a[i]] = true;
    }
  }
  memset(mark, 0, sizeof mark);
  int j = 0;
  for (int i = 0; i < avb.size(); i++) {
    int p = avb[i];
    if (mark[a[p]] == false and
        (a[p] < vec[j] or p == G[a[p]][G[a[p]].size() - 1])) {
      mark[a[p]] = true;
    } else {
      a[p] = vec[j++];
    }
  }
  cout << vec.size() << endl;
  for (int i = 0; i < n; i++) {
    cout << a[i] + 1 << " ";
  }
  cout << endl;
}
