#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 5e9 + 10;
const int maxk = 30;
int a[(int)1e5 * 2 + 100];
int c[(int)1e5 * 2 + 100];
bool evil[(int)1e5 * 2 + 100];
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  memset(c, 0, sizeof(c));
  vector<int> arr;
  long long x = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    c[a[i]]++;
  }
  long long j = 0;
  map<long long, long long> real;
  memset(evil, false, sizeof(evil));
  for (int i = 1; i <= n; i++) {
    if (c[i] == 0) arr.push_back(i);
    if (c[a[i]] > 1) evil[i] = true;
    real[i] = c[i];
  }
  int has[n + 1];
  bool done[n + 1];
  memset(done, false, sizeof(done));
  memset(has, 0, sizeof(has));
  for (int i = 1; i <= n; i++) {
    if (j == ((int)arr.size())) break;
    if (evil[i]) {
      if (done[a[i]] == false) {
        if (arr[j] > a[i]) {
          done[a[i]] = true;
        } else {
          if (has[a[i]] + 1 == real[a[i]]) {
          } else {
            has[a[i]]++;
            a[i] = arr[j];
            j++;
            x++;
          }
        }
      } else {
        has[a[i]]++;
        a[i] = arr[j];
        j++;
        x++;
      }
    }
  }
  cout << x << endl;
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
