#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005], c[200005];
int num = 0;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (b[i] == 0) c[++num] = i;
  }
  cout << num << endl;
  sort(c + 1, c + 1 + num);
  int tot = 0;
  int hson[200005];
  memset(hson, 0, sizeof(hson));
  for (int i = 1; i <= n; i++) {
    if (b[a[i]] > 1) {
      if (c[tot + 1] > a[i] && hson[a[i]] == 0) {
        hson[a[i]]++;
        continue;
      }
      tot++;
      b[a[i]]--;
      a[i] = c[tot];
    }
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
