#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
const double eps = 1e-8;
int a[maxn];
int n;
set<int> s, s1, s2;
map<int, int> ma;
int vis[maxn];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) s1.insert(a[i]);
  int ans = n - s1.size();
  cout << ans << endl;
  for (int i = 0; i < n; i++) ma[a[i]]++;
  for (int i = 1; i <= n; i++) {
    if (!s1.count(i)) s.insert(i);
  }
  for (int i = 0; i < n; i++) {
    if (s.size() == 0) break;
    if (ma[a[i]] > 1) {
      int Min = *(s.begin());
      if (Min < a[i]) {
        ma[a[i]]--;
        a[i] = Min;
        s.erase(Min);
      } else {
        if (vis[a[i]] == 1) {
          ma[a[i]]--;
          a[i] = Min;
          s.erase(Min);
        }
        vis[a[i]] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
