#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
struct data {
  data() {}
  bool friend operator<(data a, data b) {}
};
int n, m, k;
long long N, M, K;
int vis[200005];
int a[200005];
set<int> st;
int chk[2000005];
int main() {
  int t, tc = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) st.insert(i);
  }
  int l = st.size();
  for (int i = 1; i <= n; i++) {
    int x = a[i];
    if (vis[x] > 1) {
      int mn = *st.begin();
      if (chk[x] == 1) {
        vis[x]--;
        st.erase(mn);
        a[i] = mn;
      } else {
        if (mn < x) {
          vis[x]--;
          a[i] = mn;
          st.erase(mn);
        } else {
          chk[x] = 1;
        }
      }
    }
  }
  printf("%d", l);
  puts("");
  for (int i = 1; i <= n; i++) {
    printf("%d", a[i]);
    if (i != n) printf(" ");
  }
  puts("");
  return 0;
}
