#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lca(long long a, long long b) { return (a * b / gcd(a, b)); }
long long digitsum(long long n) {
  long long ans = 0;
  while (n) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}
vector<long long> combine(const vector<long long>& a,
                          const vector<long long>& b) {
  vector<long long> res(a.size());
  for (long long i = 0; i < a.size(); i++) {
    res[i] = i;
  }
  for (long long i = 0; i < a.size(); i++) {
    res[i] = b[a[i]];
  }
  return res;
}
long long cnt(const string& s) {
  set<char> ans;
  for (long long i = 0; i < s.length(); i++) ans.insert(s[i]);
  return ans.size();
}
long long get_new_cur(long long id, long long a, long long b, long long f,
                      long long cur, bool flag) {
  long long d1, d2;
  if (id & 1) {
    d1 = f;
    d2 = a - f;
  } else {
    d1 = a - f;
    d2 = f;
  }
  if (flag) {
    long long z = b - d2;
    if (cur < d1) return -1;
    if (z < 0)
      return -1;
    else {
      return z;
    }
  } else {
    long long nz = cur - d2;
    if (nz < 0)
      return -1;
    else
      return nz;
  }
}
int main() {
  long long n;
  cin >> n;
  set<long long> cand;
  for (long long i = 1; i <= n; i++) {
    cand.insert(i);
  }
  vector<long long> a(n);
  map<long long, queue<long long> > pos;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (pos.find(a[i]) == pos.end()) {
      pos[a[i]] = queue<long long>();
      if (cand.find(a[i]) != cand.end()) cand.erase(a[i]);
    }
    pos[a[i]].push(i);
  }
  long long cnt = 0;
  vector<long long> w;
  map<long long, long long> count;
  for (auto x : pos) {
    count[x.first] = x.second.size();
    while (x.second.size() > 0) {
      long long elem = x.second.front();
      x.second.pop();
      w.push_back(elem);
    }
  }
  sort(w.begin(), w.end());
  deque<long long> d;
  for (auto elem : w) {
    d.push_back(elem);
  }
  cnt = cand.size();
  vector<bool> flag(a.size() + 1, false);
  for (auto x : cand) {
    while (true) {
      long long pos = d.front();
      d.pop_front();
      long long cur = a[pos];
      if (cur < x && count[cur] > 1 && !flag[cur]) {
        flag[cur] = true;
        continue;
      }
      if (count[a[pos]] > 1) {
        count[a[pos]]--;
        a[pos] = x;
        break;
      }
    }
  }
  cout << cnt << endl;
  for (long long i = 0; i < a.size(); i++) {
    cout << a[i] << " ";
  }
  return 0;
}
