import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void main() {
    readint();
    auto ss = readints();

    bool[int] map;
    foreach (s; ss)
        map[s] = true;

    readint();
    auto ts = readints();

    int ans = 0;
    foreach (t; ts) {
        auto p = t in map;
        if (p != null)
            ans++;
    }
    writeln(ans);
}