import std.stdio, std.string, std.array, std.conv;

bool binarySearch(int n, int key, int[] x) {
    int l = 0, r = n, m;
    while (l < r) {
        m = (l + r) / 2;
        if (key == x[m]) return true;
        if (key < x[m]) {
            r = m;
        } else {
            l = m + 1;
        }
    }
    return false;
}

void main() {
    int n = readln.chomp.to!int;
    int[] s = readln.chomp.split.to!(int[]);
    int q = readln.chomp.to!int;
    int[] t = readln.chomp.split.to!(int[]);
    int cnt = 0;
    foreach (x; t) {
        if (binarySearch(n, x, s)) ++cnt;
    }
    cnt.writeln;
}
