12: Missing number

Given an array containing n distinct integers 0, 1, 2, ..., n. Write a method to find the one missing integer from the array

 

Example 1

Input: [1, 2, 0, 4]

Output: 3

Example 2

Input: [0, 2, 1, 4, 3, 6]

Output: 5