#include <bits/stdc++.h>
using namespace std;
const int N = (int)(6e6);
int mp[N];
bool vis[N];
int main() {
  int n;
  scanf("%d", &n);
  int arr[n];
  for (int i = 0; i < n; i++) scanf("%d", arr + i), mp[arr[i]]++;
  int sz = 0;
  for (int i = 1; i <= n; i++) sz += (mp[i] == 0);
  vector<int> rem;
  for (int i = 1; i <= n; i++)
    if (!mp[i]) rem.push_back(i);
  reverse(rem.begin(), rem.end());
  for (int i = 0; i < n; i++) {
    if (mp[arr[i]] > 1) {
      if (rem.back() < arr[i]) {
        mp[arr[i]]--;
        arr[i] = rem.back();
        mp[arr[i]]++;
        rem.pop_back();
      } else {
        if (!vis[arr[i]])
          vis[arr[i]] = 1;
        else {
          mp[arr[i]]--;
          arr[i] = rem.back();
          mp[arr[i]]++;
          rem.pop_back();
        }
      }
    }
  }
  printf("%d\n", sz);
  for (int i = 0; i < n; i++) printf("%d ", arr[i]);
  puts("");
  return 0;
}
