Description

Find the Missing Number

Design a hardware module that finds the missing number in an array. Given an array nums containing n distinct numbers taken from the range [0, n], return the only number in the range that is missing from the array.

Example: For input array [3, 0, 1], the output should be 2.

Source: LeetCode 268 - Missing Number

Input

nums

Stream of 16-bit Unsigned Integer
Array containing n distinct numbers taken from [0, n].

Output

16-bit Unsigned Integer
The missing number.