#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
int a[maxn + 5], rep[maxn + 5], vis[maxn + 5];
queue<int> q;
int main() {
  memset(rep, 0, sizeof(rep));
  memset(vis, 0, sizeof(vis));
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    rep[a[i]]++;
    if (rep[a[i]] > 1) ans++;
  }
  for (int i = 1; i <= n; i++)
    if (!rep[i]) q.push(i);
  for (int i = 1; i <= n; i++) {
    if (rep[a[i]] > 1) {
      if (q.front() < a[i]) {
        rep[a[i]]--;
        a[i] = q.front();
        q.pop();
      } else {
        if (!vis[a[i]])
          vis[a[i]] = 1;
        else {
          rep[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;
}
