SOLVE

LATER

Odd Even Pairs

Problem

Editorial

Analytics

Our friend Monk was given an integer array $$A$$ of size $$N$$. He got a task to calculate the **Absolute Difference between the number of odd and even pairs** present in this array $$A$$.

A Pair of $$2$$ integers $$(i,j)$$ is called an odd pair, if $$i < j$$, and $$A[i]+A[j]$$ is not divisible by $$2$$. A pair of integers $$(i,j)$$ is called even, if $$i < j$$, and $$A[i]+A[j]$$ is divisible by $$2$$.

This task seems a little bit tricky to him, and wants you to help him out. Can you ?

**Input Format:**

The first Line contains an integer $$N$$ denoting the size of array. The next line contains $$N$$ space separated integers, where the $$i^{th}$$ integer denotes $$A[i]$$.

**Output Format** :

Print the required answer on a single line.

**Constraints:**

$$ 1 \le N \le 100000 $$

$$ 1 \le A[i] \le 100000$$

Explanation

Even pairs- (1,3) ==> 1

Odd Pairs- (1,2), (2,3) ==> 2

$$ Difference = absolute value (Odd Pairs -Even Pairs)==1 $$

Time Limit:
2.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"847dc5e": "/pagelets/suggested-problems/algorithm/odd-even-pairs-4/", "a12d936": "/pagelets/problems-hint/algorithm/odd-even-pairs-4/", "aa4380a": "/pagelets/problem-author-tester/algorithm/odd-even-pairs-4/", "5b001f5": "/pagelets/recommended-problems/algorithm/odd-even-pairs-4/", "e2b0f18": "/pagelets/show-submission/algorithm/odd-even-pairs-4/"}

realtime.hackerearth.com

80

c3068fc7b38ce76ccc89f166d14d2822b34b6850

58a29e5cae2309f04b28

/realtime/pusher/auth/