//Carl Chan
//Earl Haig


#include <math.h>
#include <stdio.h>
#include <fstream>
#include <iostream>

using namespace std;


int main()
{
    
    int taken,
        m,
        count1,
        count2,
        temp;
        
    int others[5][100];    
    
    ifstream data3;
    ofstream out3;
    data3.open("DATA3.txt");
    out3.open("OUT3.txt");

    
    for (count1=0;count1<5;count1++)
    {
        
        data3 >> m;
        
        for (count2=0;count2<m;count2++)
        {
            
            data3 >> others[count1][count2];
            
        }
        
        
        for (int count3=0;count3<(m-1);count3++)
        {
            for (count2=0;count2<(m-2);count2++)
            {            
                if (others[count1][count2] > others[count1][(count2+1)])
                {
                    temp = others[count1][count2];
                    others[count1][count2] = others[count1][(count2+1)];
                    others[count1][(count2+1)] = temp;                                           
                }            
            }
         }    
         
         if (others[count1][(m-1)] != m+1)
         {
              taken = m+1;              
         }
         else  if (others[count1][0] != 1)
         {
             taken = 1;
         }
         else
         {
             for (count2=1;count2<(m);count2++)
             {
                 
                 if ((others[count1][count2]-others[count1]
                    [(count2-1)]) > 1)
                 {
                     taken = count2+1;                                   
                 }
                 
                 
             }
             
         }
         
         
         out3 << taken << "\n";        
         
        
    } 
    
    
    data3.close();
    out3.close();
        
    
    return 0;
    
}

