unittest
{
	assert( [ "3", "apple", "orange", "apple", "1", "grape" ].parse.expand.solve == 2 );
	assert( [ "3", "apple", "orange", "apple", "5", "apple", "apple", "apple", "apple", "apple" ].parse.expand.solve == 1 );
	assert( [ "1", "voldemort", "10", "voldemort", "voldemort", "voldemort", "voldemort", "voldemort", "voldemort", "voldemort", "voldemort", "voldemort", "voldemort" ].parse.expand.solve == 0 );
	assert( [ "6", "red", "red", "blue", "yellow", "yellow", "red", "5", "red", "red", "yellow", "green", "blue" ].parse.expand.solve == 1 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
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.strip.to!( long );
	auto ss = new string[ n ];
	foreach( ref s; ss )
	{
		input.popFront;
		s = input.front.strip;
	}
	input.popFront;
	auto m = input.front.strip.to!( long );
	auto ts = new string[ m ];
	foreach( ref t; ts )
	{
		input.popFront;
		t = input.front.strip;
	}
	return tuple( ss, ts );
}

auto solve( string[] ss, string[] ts )
{
	auto us = ( [ "" ] ~ ss.dup ).sort().uniq;
	auto cm = long.min;
	
	foreach( u; us )
	{
		auto c = 0L;
		
		foreach( s; ss )
		{
			if( u == s ) c++;
		}
		
		foreach( t; ts )
		{
			if( u == t ) c--;
		}
		
		if( cm < c ) cm = c;
	}
	
	return cm;
}
