#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p, long long m) {
  if (p == 0) return 1;
  long long my = bigmod(b, p / 2, m);
  my *= my;
  my %= m;
  if (p & 1) my *= b, my %= m;
  return my;
}
long long setb(long long n, long long pos) { return n = n | (1 << pos); }
long long resb(long long n, long long pos) { return n = n & ~(1 << pos); }
bool checkb(long long n, long long pos) { return (bool)(n & (1 << pos)); }
int n, ara[200005], cnt[200005], keep[200005];
priority_queue<int> pq;
int main() {
  int i, tot = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &ara[i]), cnt[ara[i]]++;
  for (i = 1; i <= n; i++) {
    if (cnt[i] == 0) {
      tot++;
      pq.push(-i);
    }
  }
  int baki = tot;
  for (i = 1; i <= n; i++) {
    int my = ara[i];
    if (cnt[my] > 1) {
      int nxt = -1 * pq.top();
      if (nxt < my) {
        pq.pop();
        cnt[nxt]++;
        cnt[my]--;
        ara[i] = nxt;
        baki--;
      } else if (keep[my] == 1) {
        pq.pop();
        cnt[nxt]++;
        cnt[my]--;
        ara[i] = nxt;
        baki--;
      } else
        keep[my] = 1;
    }
  }
  printf("%d", tot);
  printf("\n");
  for (i = 1; i <= n; i++) {
    if (i > 1) printf(" ");
    printf("%d", ara[i]);
  }
  printf("\n");
  return 0;
}
