AlgoUniversity
  • Go Back
Discussion
Nick'S Check :

Author

Yash Sahijwani

Difficulty Level : Easy

Submissions : 93

Asked In : Virtusa

Marks :10

: 1 | : 0

Nick has been given a list of random numbers by his teacher. His task is to arrange all the numbers in increasing order, and check whether the numbers are consecutive or not. If all the numbers are consecutive, output "YES", otherwise output "NO".

Input

The first line consists of an integer $$$n$$$ $$$-$$$ the total number of integers given by the teacher $$$(1 \leq n \leq 10^6)$$$. The next line consists of $$$n$$$ space separated integers, $$$a_i$$$ $$$(1 \leq a_i \leq 10^9)$$$ the numbers of the array.

Output

Output a single word - "YES" if the marks are consecutive, "NO" otherwise.

Examples

Input
4
7 8 5 6
Output
YES
Input
4
10 8 9 8
Output
NO
Input
5
1 9 10 4 2
Output
NO

Note

Note that if two marks are the same, then they are not considered consecutive.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.