#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int used[maxn], t[maxn], s[maxn];
bool ok[maxn];
int main() {
  int n;
  scanf("%d", &n);
  memset(used, 0, sizeof(used));
  memset(ok, 0, sizeof(ok));
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    t[i] = a;
    used[a]++;
  }
  priority_queue<int, vector<int>, greater<int> > que;
  for (int i = 1; i <= n; i++)
    if (!used[i]) que.push(i);
  for (int i = 1; i <= n; i++) {
    if (used[t[i]] > 1 &&
        (que.top() < t[i] || (que.top() >= t[i] && ok[t[i]] == true))) {
      used[t[i]]--;
      s[i] = que.top();
      que.pop();
      used[s[i]]++;
    } else {
      s[i] = t[i];
      if (used[t[i]] > 1) ok[t[i]] = true;
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (t[i] != s[i]) cnt++;
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= n; i++) {
    if (i - 1) printf(" ");
    printf("%d", s[i]);
  }
  return 0;
}
