def find_missing_number(arr):
n = len(arr) # n is the number of elements in the array
expected_sum = n * (n + 1) // 2 # Sum of first n natural numbers
actual_sum = sum(arr) # Sum of the elements in the array
missing_number = expected_sum - actual_sum # The missing number
return missing_number
# Example usage:
arr = [0, 1, 2, 4] # Here, n = 4, and the missing number is 3
missing = find_missing_number(arr)
print(f"The missing number is: {missing}")