import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	}
}
	 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	}
} Main public static void main(String[] args) {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	} main {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	} int count = 0; count 0 Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] S = new int[n]; S new int[n] n for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = scanner.nextInt();
		} {
			S[i] = scanner.nextInt();
		} S[i] = scanner.nextInt() S[i] S i scanner.nextInt() scanner.nextInt scanner int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int[] T = new int[q]; T new int[q] q for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = scanner.nextInt();
		} {
			T[i] = scanner.nextInt();
		} T[i] = scanner.nextInt() T[i] T i scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		} {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		} int index = T[i]; index T[i] T i int min = 0; min 0 int max = n - 1; max n - 1 n 1 int weight; weight while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			} true {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			} weight = (min + max) / 2 weight (min + max) / 2 (min + max) min max 2 if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				} S[weight] == index S[weight] S weight index {
					count++;
					break;
				} count++ count break; if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				} min > max min max {
					break;
				} break; {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				} if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					} S[weight] < index S[weight] S weight index {
						min = weight + 1;
					} min = weight + 1 min weight + 1 weight 1 {
						max = weight - 1;
					} max = weight - 1 max weight - 1 weight 1 System.out.println(count) System.out.println System.out System System.out count scanner.close() scanner.close scanner String[] args args public class Main {
	public static void main(String[] args) {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	}
} public class Main {
	public static void main(String[] args) {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int count = 0;
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scanner.nextInt();
		}

		int q = scanner.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = scanner.nextInt();
		}

		for (int i = 0; i < q; i++) {
			int index = T[i];
			int min = 0;
			int max = n - 1;
			int weight;
			while (true) {
				weight = (min + max) / 2;
				if (S[weight] == index) {
					count++;
					break;
				} else if (min > max) {
					break;
				} else {
					if (S[weight] < index) {
						min = weight + 1;
					} else {
						max = weight - 1;
					}
				}
			}
		}
		System.out.println(count);
                scanner.close();
	}
}
	