#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 0.0000000001;
const int N = 500000 + 10;
int vis[N];
int a[N];
int b[N];
map<int, int> mp;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int t = 0;
    memset(b, 0, sizeof(b));
    memset(vis, 0, sizeof(vis));
    mp.clear();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      vis[a[i]]++;
    }
    for (int i = 1; i <= n; i++) {
      if (vis[i] == 0) {
        b[t++] = i;
      }
    }
    sort(b, b + t);
    cout << t << endl;
    t = 0;
    for (int i = 1; i <= n; i++) {
      if (vis[a[i]] == 1 && mp[a[i]] == 0) {
        cout << a[i] << " ";
        mp[a[i]] = 1;
      } else if (a[i] < b[t]) {
        if (mp[a[i]] == 0) {
          cout << a[i] << " ";
          mp[a[i]] = 1;
        } else {
          cout << b[t] << " ";
          vis[a[i]]--;
          t++;
        }
      } else if (a[i] > b[t]) {
        if (b[t]) {
          cout << b[t] << " ";
          vis[a[i]]--;
          t++;
        } else {
          cout << a[i] << " ";
          vis[a[i]]--;
        }
      }
    }
    cout << endl;
  }
}
