unittest
{
	assert( [ "2", "1 3 1 2" ].parse.expand.solve == 3 );
	assert( [ "5", "100 1 2 3 14 15 58 58 58 29" ].parse.expand.solve == 135 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto ls = input.front.split.to!( long[] );
	return tuple( ls );
}

auto solve( long[] ls )
{
	ls.sort();
	
	auto ans = 0L;
	for( auto i = 0L; i < ls.length; i += 2 ) ans += ls[ i ];
	return ans;
}
