AlgoUniversity
  • Go Back
Discussion
Odd Subset :

Author

Akshay Sharma

Difficulty Level : Easy

Submissions : 55

Asked In : relevel

Marks :100

: 2 | : 0

Antonio got an array for his Christmas present. the array he got consists of N positive integers.

He was getting bored on Christmas eve and decided to solve the below problem to overcome his boredom:

What's the minimum length subset of the given array such that the sum of all elements of this subset is an odd number?

Antonio got stuck in the problem and has a party to attend at night. hence you being Antonio's best friend decided to help him solve the problem.

Given array A print the maximum possible length of a subset of this array such that the sum of all elements of this is an odd number. If there is no subset present print -1

A subset of array A as a tuple can be obtained from A by removing some (possibly all elements of it)

Input

First line contain a single integer N .($$$1 \le N \le 10^5$$$)

The next line contains N space-separated integers denoting the elements of array A.($$$1 \le a[i] \le 10^9$$$)

Output

Print the maximum possible length of print -1 if no subset is present.

Example

Input
4 
4 2 3 1 
Output
3

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.