Problem:
Score : 300 points

Problem Statement

There are N integers written on a blackboard. The i-th integer is A_i.

Takahashi will repeatedly perform the following operation on these numbers:

Select a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.

Then, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.

Determine whether it is possible to have only one integer on the blackboard.

Constraints

2 ≦ N ≦ 10^5

1 ≦ A_i ≦ 10^9

A_i is an integer.

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 … A_N

Output

If it is possible to have only one integer on the blackboard, print YES. Otherwise, print NO.

Sample Input 1

3
1 2 3

Sample Output 1

YES

It is possible to have only one integer on the blackboard, as follows:

Erase 1 and 3 from the blackboard, then write 4. Now, there are two integers on the blackboard: 2 and 4.

Erase 2 and 4 from the blackboard, then write 6. Now, there is only one integer on the blackboard: 6.

Sample Input 2

5
1 2 3 4 5

Sample Output 2

NO

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;






namespace contest
{




    class contest
    {


        static void Main(string[] args)
        {


            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();




            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];






            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();




            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}


            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            

            bool ok = true;
            int odd = 0;
            for(int i=0; i< n; i++)
            {
                if (arr[i] % 2 == 1) odd++;
            }

            if (odd % 2 != 0) ok = false;


            if(ok)Console.WriteLine("YES");
            else Console.WriteLine("NO");



            //Console.WriteLine();








            //Console.Read();


            //Console.Read();



        }

        

    }




    class Segment
    {
        public int[] arr;


        public int n;

        public Segment(int m)
        {
            this.n = m;
            //arr = Enumerable.Range(0, n*2).ToArray();
            arr = new int[n * 4];


            for (int i = 0; i < n * 4; i++)
            {
                arr[i] = int.MaxValue;
            }

        }


        //public void update(int p, int value)
        //{  // set value at position p
        //    for (arr[p += n] = value; p > 1; p >>= 1) arr[p >> 1] = Math.Min( arr[p] , arr[p ^ 1]);
        //}



        //public void update(int i, int value)
        //{
        //    i += n / 2;
        //    arr[i] = value;
        //    for (; i > 1; i >>= 1)
        //        arr[i >> 1] = Math.Min(arr[i], arr[i ^ 1]);
        //}


        public void update(int i, int x)
        {
            //i = (n / 2) + i - 1;
            i = n + i - 1;
            arr[i] = x;


            while (i > 0)
            {
                i = (i - 1) / 2;
                arr[i] = Math.Min(arr[(i * 2) + 1], arr[(i * 2) + 2]);


                //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                //{
                //    arr[i] = arr[i * 2 + 1];
                //}
                //else
                //{
                //    arr[i] = arr[i * 2 + 2];
                //}
                //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];

            }

        }




        //call : query(a,b, 0, 0, n)
        public int query(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return int.MaxValue;
            if (a <= l && r <= b) return arr[k];

            //return Math.Min(query(a, b, (k * 2) + 1, l, (l + r) / 2), query(a, b, (k * 2) + 2, (l + r) / 2, r));      


            var vl = query(a, b, (k * 2) + 1, l, (l + r) / 2);
            var vr = query(a, b, (k * 2) + 2, (l + r) / 2, r);

            //var vl = query(a, b, (k << 1) + 1, l, (l + r) / 2);
            //var vr = query(a, b, (k + 1) << 1, (l + r) / 2, r);



            if (vl == int.MaxValue && vr == int.MaxValue) return 0;
            return Math.Min(vl, vr);


        }


        //public int query(int a, int b, int k, int l, int r)
        //{
        //    // query for arr[i..j]

        //    if (l > b || r < a)               // segment completely outside range
        //        return int.MaxValue;                       // represents a null node

        //    if (a <= l && b >= r)             // segment completely inside range
        //        return arr[k];

        //    int mid = l + (r - l) / 2;       // partial overlap of current segment and queried range. Recurse deeper.

        //    if (a > mid)
        //        return query(2 * k + 2, mid + 1, r, a, b);
        //    else if (b <= mid)
        //        return query(2 * k + 1, l, mid, a, b);

        //    int leftQuery = query(2 * k + 1, l, mid, a, mid);
        //    int rightQuery = query(2 * k + 2, mid + 1, r, mid + 1, b);

        //    // merge query results
        //    if (leftQuery == int.MaxValue && rightQuery == int.MaxValue) return 0;
        //    return Math.Min(leftQuery, rightQuery);


        //}








        //public int query(int l, int r)
        //{
        //    int res = int.MaxValue;
        //    for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        //    {
        //        if ((l & 1) == 1) res = Math.Min(res, arr[l++]);
        //        if ((r & 1) == 1) res = Math.Min(res, arr[--r]);
        //    }
        //    return res;
        //}



        //public int query(int a, int b, int r)
        //{
        //    int res = int.MaxValue;
        //    for (a += r / 2, b += r / 2; a <= b; a = (a + 1) >> 1, b = (b - 1) >> 1)
        //    //for (; a <= b; a = (a + 1) >> 1, b = (b - 1) >> 1)
        //    {
        //        if ((a & 1) != 0)
        //            res = Math.Min(res, arr[a]);
        //        if ((b & 1) == 0)
        //            res = Math.Min(res, arr[b]);
        //    }
        //    return res;
        //}




        //public int query(int l, int r)
        //{  // sum on interval [l, r)
        //    int res = int.MaxValue;
        //    for (l += n, r += n; l < r; l >>= 1, r >>= 1)
        //    {
        //        if ((l & 1) == 1) res = Math.Min(res, arr[l++]);

        //        if ((r & 1) == 1) res = Math.Min(res, arr[--r]);
        //    }
        //    return res;
        //}

    }


    class UnionFind
    {
        public int[] path;
        //public int[] parent;
        //public int[] child;

        public UnionFind(int n)
        {
            path = new int[n + 1];
            //parent = new int[n];
            //child = new int[n];

            for (int i = 0; i < n + 1; i++)
            {
                path[i] = i;
                //parent[i] = i;
                //child[i] = i;
            }

        }

        private int root(int i)
        {
            while (i != path[i])
            {
                path[i] = path[path[i]];
                i = path[i];
            }
            return i;
        }



        public bool find(int p, int q)
        {
            return root(p) == root(q);
        }



        public void unite(int p, int q)
        {



            int i = root(p);
            int j = root(q);
            if (i < j)
            {

                int tmp = i;
                i = j;
                j = tmp;
            }
            path[i] = j;

            //    int t = p;
            //    while (path[parent[t]] != j)
            //    {
            //        path[path[t]] = j;
            //        t = parent[t];
            //    }

            //t = p;
            //while (path[child[t]] != j)
            //{
            //    path[path[t]] = j;
            //    t = child[t];
            //}


            //parent[q] = p;
        }


    }
}