#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long double pii = 3.14159265359;
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> m(N + 1), v(N), flg(N + 1);
  for (auto& i : v) cin >> i, m[i]++;
  stack<int> S;
  for (int x = (N + 1) - 1; x >= 1; x--) {
    if (!m[x]) S.push(x);
  }
  int ans = 0;
  for (int x = 0; x < (N); x++) {
    int& i = v[x];
    if (m[i] > 1) {
      if (S.top() < i) {
        ans++;
        m[i]--;
        i = S.top();
        S.pop();
      } else {
        if (!flg[i]) {
          flg[i] = 1;
          continue;
        }
        ans++;
        m[i]--;
        i = S.top();
        S.pop();
      }
    }
  }
  cout << ans << nl;
  for (auto& i : v) cout << i << ' ';
  return 0;
}
