882. Make all elements of Array Zero
1
Easy
Given a non-negative integer array nums, the task is to make all elements of the array equal to zero. In each operation, you can choose a positive integer x that is less than or equal to the smallest non-zero element in nums. Then, you subtract x from every positive element in nums. Find the minimum number of operations required to achieve this goal.
Input Format
The first line contains an integer N, which represents the size of the array.
The second line consists of N space-separated integers, which are the elements of the array.
Output Format
An integer representing the minimum number of operations required.
Example
Input
5
1 5 0 3 5
Output
3
Constraints
1 <= N <= 103
Loading...
View Submissions
Console