unittest
{
	assert( [ "4", "4", "0", "3", "2" ].parse.expand.solve == 4 );
	assert( [ "8", "2", "0", "1", "6", "0", "8", "2", "1" ].parse.expand.solve == 9 );
}



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 ) )
{
	auto n = input.front.to!( long );
	auto as = new long[ n ];
	foreach( ref a; as )
	{
		input.popFront;
		a = input.front.to!( long );
	}
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	for( auto i = 0L; i < as.length; i++ )
	{
		auto c = as[ i ] / 2;
		as[ i ] -= c * 2;
		if( i + 1 < as.length && 0 < as[ i ] && 0 < as[ i + 1 ] )
		{
			c++;
			as[ i + 1 ]--;
		}
		ans += c;
	}
	return ans;
}
