```
public int missingNumber(int[] nums) {
if(nums.length==0) return 0;
int total = 0;
int real = 0;
for(int i =0; i<nums.length;i++){
total+=i;
real+=nums[i];
}
total+=nums.length;
return (total-real);
}
```