import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.range;
import std.stdio;
import std.string;

T binarySearch(T)(T[] haystack, T needle) {
  auto min = 0UL;
  auto max = haystack.length - 1;

  while (min <= max) {
    auto mid = (min + max) / 2;
    if (haystack[mid] == needle) {
      return needle;
    } else if (haystack[mid] < needle) {
      min = mid + 1;
    } else {
      max = mid - 1;
    }
  }
  return -1;
}

void main() {
  auto n = readln.chomp.to!int;
  auto s = readln.chomp.split.map!(to!int).array;
  auto q = readln.chomp.to!int;
  auto t = readln.chomp.split.map!(to!int).array;

  auto c = 0;

  foreach (e_t; t) {
    if (binarySearch(s, e_t) == e_t) {
      c++;
    }
  }

  c.writeln;
}