static int[]f(int[]c){int j=0;int h()=>c.Contains(++j)?h():j;return c.Select((e,i)=>Array.IndexOf(c,e)<i?h():e).ToArray();}
public static void Main()
test(new int[] { 1, 4, 2, 5, 3, 6 });
test(new int[] { 3, 3, 3, 3, 3, 3 });
test(new int[] { 6, 6, 4, 4, 2, 2 });
test(new int[] { 2147483647, 2, 2147483647, 2 });
static void test(int[] input)
Console.WriteLine("Input: " + string.Join(", ", input));
Console.WriteLine("Output: " + string.Join(", ", output));