class Solution {
public:
int getMissingNumber(vector[HTML_REMOVED]& nums) {
if(nums.size()==0)return 0;
if(nums.size()==1)return 1;
int l=0,r=nums.size()-1;
while(l<r)
{
int mid=(l+r+1)/2;
if(mid==nums[mid])l=mid;
else if(mid<nums[mid])r=mid-1;
}
if(nums[r]!=r)return r;
else return r+1;
}
};