#include <bits/stdc++.h>
using namespace std;
const int maxm = 3e6 + 7;
const int maxn = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
deque<int> q;
int n, ans = 0;
bool judge[maxn];
int num[maxn], sum[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n;
  memset(judge, false, sizeof judge);
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
    sum[num[i]]++;
  }
  for (int i = 1; i <= n; i++)
    if (!sum[i]) q.push_back(i);
  for (int i = 1; i <= n; i++) {
    if (sum[num[i]] > 1 && num[i] < q.front() && !judge[num[i]]) {
      judge[num[i]] = true;
      continue;
    }
    if (sum[num[i]] > 1) {
      sum[num[i]]--;
      num[i] = q.front();
      q.pop_front();
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) cout << num[i] << ' ';
  return cout << endl, 0;
}
