#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, a[N], fr[N], ans, isthere[N], cant[N];
vector<int> pos, v, ok[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    fr[a[i]]++;
    ok[a[i]].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    if (fr[i] == 1) continue;
    if (fr[i] == 0)
      v.push_back(i);
    else
      pos.insert(pos.end(), (ok[i]).begin(), (ok[i]).end());
  }
  sort((pos).begin(), (pos).end());
  int j = 0;
  for (int i = 0; i < v.size(); ++i) {
    while (v[i] > a[pos[j]] && !isthere[a[pos[j]]] || cant[a[pos[j]]])
      isthere[a[pos[j++]]] = 1;
    fr[a[pos[j]]]--;
    if (fr[a[pos[j]]] == 1) cant[a[pos[j]]] = 1;
    a[pos[j]] = v[i];
  }
  cout << v.size() << endl;
  for (int i = 0; i < n; ++i) {
    printf("%d ", a[i]);
  }
  puts("");
}
