#include <bits/stdc++.h>
using namespace std;
bool checkBit(long long n, int i) { return n & (1LL << i); }
long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
template <typename T>
T POW(T b, T p) {
  T r = 1;
  while (p) {
    if (p & 1) r = (r * b);
    b = (b * b);
    p >>= 1;
  }
  return r;
}
long long big_mod(long long n, long long p) {
  if (p == 0) return 1;
  if (!(p & 1)) {
    long long r = big_mod(n, p / 2) % 1000000007;
    return ((r % 1000000007) * (r % 1000000007)) % 1000000007;
  } else
    return ((n % 1000000007) * (big_mod(n, p - 1) % 1000000007)) % 1000000007;
}
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int ar[200010];
map<int, int> mp;
set<int> s;
vector<int> v, vv;
int main() {
  int n, p, cnt;
  while (cin >> n) {
    for (int i = 0; i < (n); i++) {
      cin >> ar[i];
      s.insert(ar[i]);
      mp[ar[i]]++;
    }
    if (s.size() == n) {
      cout << "0" << endl;
      for (int i = 0; i < (n - 1); i++) cout << ar[i] << " ";
      cout << ar[n - 1] << endl;
      continue;
    }
    for (int i = 1; i <= n; i++)
      if (mp[i] == 0) v.push_back(i);
    v.push_back(200001);
    p = 0;
    for (int i = 0; i < n; i++) {
      if (mp[ar[i]] == 1) {
        vv.push_back(ar[i]);
        mp[ar[i]] = -1;
      } else if (mp[ar[i]] > 1) {
        if (ar[i] <= v[p]) {
          vv.push_back(ar[i]);
          mp[ar[i]] = 0;
        } else {
          vv.push_back(v[p]);
          mp[ar[i]] -= 1;
          p++;
        }
      } else if (mp[ar[i]] == 0) {
        vv.push_back(v[p]);
        p++;
      }
    }
    cout << v.size() - 1 << endl;
    for (int i = 0; i < vv.size() - 1; i++) cout << vv[i] << " ";
    cout << vv[vv.size() - 1] << endl;
  }
}
