#include <bits/stdc++.h>
using namespace std;
queue<int> q;
int n, num[200005], a[200005], vis[200005], ans;
int main() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), num[a[i]]++;
  for (int i = 1; i <= n; i++) {
    if (num[i] > 0) ans += num[i] - 1;
    if (num[i] == 0) q.push(i);
  }
  for (int i = 1; i <= n; i++) {
    if (num[a[i]] > 1) {
      if (!vis[a[i]] && a[i] < q.front())
        vis[a[i]] = 1;
      else {
        num[a[i]]--;
        a[i] = q.front();
        q.pop();
      }
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
