import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    }
} Main public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    } main {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = Integer.parseInt(scan.nextLine()); n Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan String[] inputS = scan.nextLine().split(" "); inputS scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " int q = Integer.parseInt(scan.nextLine()); q Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan String[] inputT = scan.nextLine().split(" "); inputT scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " int[] s = new int[n]; s new int[n] n int[] t = new int[q]; t new int[q] q for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
	    s[i] = Integer.parseInt(inputS[i]);
	} {
	    s[i] = Integer.parseInt(inputS[i]);
	} s[i] = Integer.parseInt(inputS[i]) s[i] s i Integer.parseInt(inputS[i]) Integer.parseInt Integer inputS[i] inputS i for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
	    t[i] = Integer.parseInt(inputT[i]);
	} {
	    t[i] = Integer.parseInt(inputT[i]);
	} t[i] = Integer.parseInt(inputT[i]) t[i] t i Integer.parseInt(inputT[i]) Integer.parseInt Integer inputT[i] inputT i int cnt = 0; cnt 0 int high high low low j; j for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	} {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	} int key = t[i]; key t[i] t i high = n - 1 high n - 1 n 1 low = 0 low 0 while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    } true {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    } if (high < low) {
		    break;
		} high < low high low {
		    break;
		} break; j = (high + low) / 2 j (high + low) / 2 (high + low) high low 2 if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		} s[j] == key s[j] s j key {
		    cnt++;
		    break;
		} cnt++ cnt break; if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		} s[j] < key s[j] s j key {
		    low = j + 1;
		} low = j + 1 low j + 1 j 1 if (s[j] > key) {
		    high = j - 1;
		} s[j] > key s[j] s j key {
		    high = j - 1;
		} high = j - 1 high j - 1 j 1 System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    }
} public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	String[] inputS = scan.nextLine().split(" ");
	int q = Integer.parseInt(scan.nextLine());
	String[] inputT = scan.nextLine().split(" ");
	int[] s = new int[n];
	int[] t = new int[q];
	for (int i = 0; i < n; i++) {
	    s[i] = Integer.parseInt(inputS[i]);
	}
	for (int i = 0; i < q; i++) {
	    t[i] = Integer.parseInt(inputT[i]);
	}

	int cnt = 0;
	int high, low, j;
	for (int i = 0; i < q; i++) {
	    int key = t[i];
	    high = n - 1;
	    low = 0;
	    while (true) {
		if (high < low) {
		    break;
		}
		j = (high + low) / 2;
		if (s[j] == key) {
		    cnt++;
		    break;
		} else if (s[j] < key) {
		    low = j + 1;
		} else if (s[j] > key) {
		    high = j - 1;
		}
	    }
	}
	System.out.println(cnt);
    }
}