#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int ans, a[N], mp[N], ms[N], n, g[N], k, tot;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), mp[a[i]]++;
  for (int i = 1; i <= n; i++)
    if (!mp[i]) g[++tot] = i;
  k = 1;
  for (int i = 1; i <= n; i++)
    if (mp[a[i]] > 1) {
      if (k == tot + 1) {
        break;
      }
      if (ms[a[i]] || a[i] > g[k])
        mp[a[i]]--, a[i] = g[k++], mp[a[i]]++, ans++;
      else
        ms[a[i]] = 1;
    }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
}
