import std.stdio,
       std.string,
       std.range,
       std.algorithm,
       std.conv;

void main(){
	readln;
	auto S = readln.chomp.split.map!(to!int).array;
	readln;
	auto T = readln.chomp.split.map!(to!int).array;

	int c = 0;
	foreach(i; T){
		if(!S.find(i).empty)
			c++;
	}

	c.writeln();
	// filter!("a")(chain(S,T)).writeln();
}