using System;
public class Program
{
public static void Main()
int[] A = {1, 3, 6, 4, 1, 2};
int counter = 1;
int solution = 0;
for (int p = 0; p <= A.Length - 2; p++)
for (int i = 0; i <= A.Length - 2; i++)
if (A[i] > A[i + 1])
int t = A[i + 1];
A[i + 1] = A[i];
A[i] = t;
}
for (int i = 0; i < A.Length; i++)
if (counter == A[i])
counter++;
else
solution = counter;
Console.WriteLine(solution);