#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int freq[200200];
int v[200200];
int taken[200200];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    freq[v[i]]++;
    if (freq[v[i]] > 1) cnt++;
  }
  vector<int> falta;
  for (int i = 1; i <= n; i++)
    if (!freq[i]) falta.push_back(i);
  int ini = 0;
  sort(falta.begin(), falta.end());
  for (int i = 1; i <= n; i++) {
    if (freq[v[i]] == 1) continue;
    if (falta[ini] < v[i] || taken[v[i]]) {
      freq[v[i]]--;
      v[i] = falta[ini++];
    } else
      taken[v[i]] = 1;
  }
  cout << cnt << endl;
  for (int i = 1; i <= n; i++) cout << v[i] << " ";
  cout << endl;
}
