#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
priority_queue<int> q;
int n, i, x;
int cnt[N], a[N];
bool hasskip[N];
int main() {
  scanf("%d", &n);
  int kind = 0;
  for (i = 1; i <= n; ++i) {
    scanf("%d", &x);
    ++cnt[x];
    if (cnt[x] == 1) ++kind;
    a[i] = x;
  }
  for (i = 1; i <= n; ++i)
    if (cnt[i] == 0) q.push(-i);
  printf("%d\n", n - kind);
  for (i = 1; i <= n; ++i) {
    if (cnt[a[i]] > 1) {
      int tmp = -q.top();
      if (tmp > a[i] && hasskip[a[i]] == 0)
        hasskip[a[i]] = 1;
      else {
        --cnt[a[i]];
        a[i] = tmp;
        q.pop();
        ++cnt[a[i]];
      }
    }
    printf(((i == n) ? "%d\n" : "%d "), a[i]);
  }
  return 0;
}
