#include <bits/stdc++.h>
using namespace std;
int const bound = 2e6 + 2, N = 2e5 + 2;
long long OO = 1e18;
double eps = 1e-6;
int oo = 1e9, mod = oo + 7;
int aa[N];
vector<int> app[N];
vector<int> st;
int main() {
  int n;
  scanf("%d", &n);
  for (int(i) = 0; (i) < (n); (i)++) {
    scanf("%d", &aa[i]);
    app[aa[i]].push_back(i);
  }
  for (int(i) = 1; (i) <= (n); (i)++) {
    if (app[i].empty())
      st.push_back(i);
    else
      reverse(app[i].begin(), app[i].end());
  }
  reverse(st.begin(), st.end());
  int an = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    if (st.empty()) break;
    if ((int)app[aa[i]].size() == 1) continue;
    if (i != app[aa[i]].back()) {
      aa[i] = st.back();
      st.pop_back();
      an++;
    } else if (st.back() < aa[i]) {
      an++;
      app[aa[i]].pop_back();
      aa[i] = st.back();
      st.pop_back();
    }
  }
  printf("%d\n", an);
  for (int(i) = 0; (i) < (n); (i)++) printf("%d ", aa[i]);
  return 0;
}
