#include<stdio.h>
int a[200005], b[200005], sum[200005], flag[200005];
int main(void)
{
int n, i, p, k;
scanf(“%d”, &n);
for(i=1;i<=n;i++)
{
scanf(“%d”, &a[i]);
sum[a[i]]++;
}
k = 0;
for(i=1;i<=n;i++)
{
if(sum[i]==0)
b[++k] = i;
}
printf(“%d\n”, k);
p = 1;
for(i=1;i<=n;i++)
{
if(sum[a[i]]==1)
continue;
if(b[p]<a[i] || flag[a[i]]==1)
{
sum[a[i]]–;
a[i] = b[p];
sum[b[p]]++;
p++;
}
else
flag[a[i]] = 1;
}
for(i=1;i<=n;i++)
printf(“%d “, a[i]);
printf(“\n”);
return 0;
}