#include <bits/stdc++.h>
using namespace std;
template <class T>
T read(T &x, T f = 0) {
  char c = getchar();
  x = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0', c = getchar();
  }
  return x = f ? -x : x;
}
const int maxn = 2e5 + 10;
int G[maxn], tot;
int n, A[maxn], vis[maxn];
int B[maxn], used[maxn];
int main() {
  scanf("%d", &n);
  for (int i = (1), iE = (n); i <= iE; ++i) scanf("%d", &A[i]), ++vis[A[i]];
  for (int i = (1), iE = (n); i <= iE; ++i) B[i] = A[i];
  for (int i = (1), iE = (n); i <= iE; ++i)
    if (!vis[i]) G[++tot] = i;
  int ans = 0, cnt = 0;
  for (int i = (1), iE = (n); i <= iE; ++i) {
    if (vis[A[i]] > 1) {
      if (!used[A[i]] && G[cnt + 1] > A[i])
        used[A[i]] = 1;
      else
        --vis[A[i]], ++ans, B[i] = G[++cnt];
    }
  }
  cout << ans << endl;
  for (int i = (1), iE = (n); i <= iE; ++i)
    printf("%d%c", B[i], i ^ n ? ' ' : '\n');
  return 0;
}
