/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		int nums[]={1,1,2,3,3,4,4};
		 int l=0;
        int r=nums.length-1;
        while(l<r){
            int mid=(l+r)/2;
            if(mid%2==0){
                if(nums[mid]==nums[mid+1]){
                    l=mid+2;
                }
                else{
                    r=mid;
                }
            }
            else{
                if(nums[mid]==nums[mid-1]){
                    l=mid+1;
                }
                else{
                    r=mid;
                }
            }
        }
       System.out.println(nums[l]);
    }
	}
