#include <bits/stdc++.h>
using namespace std;
int n, a[200010], vis[200010], ans, vis2[200010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
    if (vis[a[i]] != 1) ans++;
  }
  int pos = 1;
  for (int i = 1; i < n + 1; i++) {
    for (; pos <= n; pos++) {
      if (vis[pos] == 0) break;
    }
    if (vis[a[i]] >= 2) {
      if (a[i] < pos && !vis2[a[i]])
        vis2[a[i]] = 1;
      else {
        vis[a[i]]--;
        vis[pos]++;
        a[i] = pos;
      }
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i < n + 1; i++) printf("%d ", a[i]);
  return 0;
}
