Problem:
Score : 200 points

Problem Statement

Snuke is having a barbeque party.

At the party, he will make N servings of Skewer Meal.

Example of a serving of Skewer Meal

He has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i.
Also, he has an infinite supply of ingredients.

To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers.
Let the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients.

What is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?

Constraints

1≦N≦100

1≦L_i≦100

For each i, L_i is an integer.

Input

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

N
L_1 L_2 ... L_{2N}

Output

Print the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold.

Sample Input 1

2
1 3 1 2

Sample Output 1

3

If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 1 and 2 ingredients, for the total of 3.

Sample Input 2

5
100 1 2 3 14 15 58 58 58 29

Sample Output 2

135

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Numerics;
using System.IO;
using static System.Math;
using static Math2;
using static io;
using static utils;


class Program
{
    static void Main(string[] args)
    {
        var wrong_answer = new wrong_answer();
        wrong_answer.Solve();
    }
}

public class wrong_answer
{
    const int INF = 1 << 29;
    const long INFL = 1L << 60;
    const int MOD = 1000000007;
    const int MOD2 = 998244353;


    public void Solve()
    {
        var n = int1;
        var l = intm;
        Array.Sort(l);
        write(l.Where((x, i) => i % 2 == 0).Sum());
    }


}

public class fraction
{
    public int Numerator { get; set; }
    public int Denominator { get; set; }
    public fraction(int x, int y) //  x / y
    {

        Numerator = x;
        Denominator = y;
        yakubun();

    }
    public static implicit operator fraction(int x)
    {
        return new fraction(x, 1);
    }
    public static explicit operator double(fraction x)
    {
        return (double)x.Numerator / (double)x.Denominator;
    }
    public void yakubun()
    {
        int x = (int)gcd((long)Numerator, (long)Denominator);
        Numerator /= x;
        Denominator /= x;
    }
    public static void yakubun(ref fraction a)
    {
        int x = (int)gcd((long)a.Numerator, (long)a.Denominator);
        a.Numerator /= x;
        a.Denominator /= x;
    }
    public static void tubun(ref fraction a, ref fraction b)
    {
        int x = (int)lcm(a.Denominator, b.Denominator);
        a.Numerator = a.Numerator * x / a.Denominator;
        b.Numerator = b.Numerator * x / b.Denominator;
        a.Denominator = x;
        b.Denominator = x;
    }
    public static void write(fraction a)
    {
        io.write(a.Numerator, a.Denominator);
    }

    public static fraction operator +(fraction a, fraction b)
    {
        tubun(ref a, ref b);
        int nume = a.Numerator + b.Numerator;
        int deno = a.Denominator;
        return new fraction(nume, deno);
    }
    public static fraction operator -(fraction a, fraction b)
    {
        tubun(ref a, ref b);
        int nume = a.Numerator - b.Numerator;
        int deno = a.Denominator;
        var x = new fraction(nume, deno);
        yakubun(ref x);
        return x;
    }
    public static fraction operator *(fraction a, fraction b)
    {
        int nume = a.Numerator * b.Numerator;
        int deno = a.Denominator * b.Denominator;
        var x = new fraction(nume, deno);
        yakubun(ref x);
        return x;
    }
    public static fraction operator /(fraction a, fraction b)
    {
        int nume = a.Numerator * b.Denominator;
        int deno = a.Denominator * b.Numerator;
        var x = new fraction(nume, deno);
        yakubun(ref x);
        return x;
    }
    public static bool operator ==(fraction a, fraction b)
    {
        fraction x = a - b;
        return (double)x == 0;
    }
    public static bool operator !=(fraction a, fraction b)
    {
        return !(a == b);
    }

    public override bool Equals(object obj)
    {
        if (this.GetType() != obj.GetType()) return false;
        var c = (fraction)obj;
        return (c.Numerator == this.Numerator && c.Denominator == this.Denominator);
    }

    public override int GetHashCode()
    {
        return -1;
    }

}


public static class utils
{
    public static int digitsum(int n)
    {
        string s = n.ToString();
        int ret = 0;
        for (int i = 0; i < s.Length; ++i) ret += s[i] - '0';
        return ret;
    }
    public static int[] zaaku(long[] a)
    {
        var dic = new Dictionary<long, int>();
        long[] ar = new long[a.Length];
        a.CopyTo(ar, 0);
        Array.Sort(ar);
        int z = 0;
        foreach (var x in ar)
        {
            if (!dic.ContainsKey(x))
                dic[x] = z++;
        }
        return a.Select(c => dic[c]).ToArray();
    }

    public static int[] retranking(long[] A)
    {
        var dic = new Dictionary<long, int>();
        A.OrderByDescending(_ => _).Where(w => !dic.ContainsKey(w)).Select((x, i) => dic[x] = i + 1).ToList();
        return A.Select(i => dic[i]).ToArray();
    }
    public static List<Tuple<T, int>> compress<T>(T[] A) where T : IComparable
    {
        int i = 0;
        var ret = new List<Tuple<T, int>>();
        while (i < A.Length)
        {
            T x = A[i];
            int num = 0;
            while (i < A.Length && x.CompareTo(A[i]) == 0)
            {
                num++;
                i++;
            }
            ret.Add(new Tuple<T, int>(x, num));
        }
        return ret;
    }
}

public static class Math2
{
    public static long pow(long i, long n, long MOD = 1000000007)
    {
        long res = 1;
        while (n > 0)
        {
            if ((n & 1) != 0) res = res * i % MOD;
            i = i * i % MOD;
            n >>= 1;
        }
        return res;
    }
    public static int pow(int i, int n, int MOD = 1000000007)
    {
        int res = 1;
        while (n > 0)
        {
            if ((n & 1) != 0) res = res * i % MOD;
            i = i * i % MOD;
            n >>= 1;
        }
        return res;
    }

    public static long gcd(long i, long y)
    {
        while (y != 0)
        {
            var r = i % y;
            i = y;
            y = r;
        }
        return i;
    }

    public static long lcm(long i, long y)
    {
        return i * y / gcd(i, y);
    }


    public static Dictionary<long, int> primefactorization(long N)
    {

        var ret = new Dictionary<long, int>();

        for (long i = 2; i * i <= N; ++i)
        {
            int cnt = 0;
            while (N % i == 0)
            {
                cnt++;
                N /= i;
            }
            if (cnt != 0) ret[i] = cnt;

        }
        if (N >= 2) ret[N] = 1;

        return ret;

    }

    public static List<long> divisorenumrate(long N)
    {
        var ret = new List<long>();

        for (long i = 1; i * i <= N; ++i)
        {

            if (N % i == 0)
            {
                ret.Add(i);
                ret.Add(N / i);
            }

        }

        return ret;

    }

    public static void swap<T>(ref T a, ref T b)
    {
        var i = a;
        a = b;
        b = i;
    }
    public static void chmin<T>(ref T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) > 0) a = b;
    }
    public static void chmax<T>(ref T a, T b) where T : IComparable
    {
        if (a.CompareTo(b) < 0) a = b;
    }

}

public static class io
{
    //in
    public static string str => Console.ReadLine();

    public static string[] strm => str.Split(' ');

    public static long[] longm => strm.Select(long.Parse).ToArray();
    public static int[] intm => strm.Select(int.Parse).ToArray();
    public static char[] charm => str.ToArray();
    public static double[] doublem => strm.Select(double.Parse).ToArray();
    public static long long1 => longm[0];
    public static int int1 => intm[0];
    public static char char1 => charm[0];
    public static double double1 => doublem[0];
    public static long[] horizontalread(int N) { long[] A = new long[N]; for (int i = 0; i < N; ++i) A[i] = long1; return A; }
    public static void write(string a) => Console.WriteLine(a);
    public static void write(params object[] i) => write(string.Join(" ", i));
    public static void write<T>(IEnumerable<T> a) => write(string.Join(" ", a));
    public static void horizontalwrite<T>(IEnumerable<T> a) { foreach (var z in a) write(z); }
    public static void yn(bool i) { if (i) write("Yes"); else write("No"); }

}