#include <bits/stdc++.h>
using namespace std;
set<int> st;
int arr[1000005];
bool taken[1000005];
map<int, int> mp;
int main() {
  int n;
  (scanf("%d", &n));
  for (int i = 1; i <= n; i++) {
    (scanf("%d", &arr[i]));
    mp[arr[i]]++;
    st.insert(i);
  }
  for (int i = 1; i <= n; i++) st.erase(arr[i]);
  memset(taken, false, sizeof(taken));
  cout << st.size() << "\n";
  for (int i = 1; i <= n; i++) {
    if (mp[arr[i]] > 1) {
      if (*st.begin() > arr[i] && taken[arr[i]] == false)
        taken[arr[i]] = true;
      else {
        mp[arr[i]]--;
        arr[i] = *st.begin();
        st.erase(st.begin());
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << arr[i] << " ";
}
