import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	} main {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	} BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int numberS = Integer.parseInt(br.readLine()); numberS Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] progressionS = br.readLine().split(" "); progressionS br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] S = new int[numberS]; S new int[numberS] numberS for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		} int i = 0; int i = 0; i 0 i < numberS i numberS i++ i++ i {
            S[i] = Integer.parseInt(progressionS[i]);
		} {
            S[i] = Integer.parseInt(progressionS[i]);
		} S[i] = Integer.parseInt(progressionS[i]) S[i] S i Integer.parseInt(progressionS[i]) Integer.parseInt Integer progressionS[i] progressionS i int numberT = Integer.parseInt(br.readLine()); numberT Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] progressionT = br.readLine().split(" "); progressionT br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] T = new int[numberT]; T new int[numberT] numberT for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		} int i = 0; int i = 0; i 0 i < numberT i numberT i++ i++ i {
			T[i] = Integer.parseInt(progressionT[i]);
		} {
			T[i] = Integer.parseInt(progressionT[i]);
		} T[i] = Integer.parseInt(progressionT[i]) T[i] T i Integer.parseInt(progressionT[i]) Integer.parseInt Integer progressionT[i] progressionT i int equalCount = 0; equalCount 0 for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		} int i = 0; int i = 0; i 0 i < numberT i numberT i++ i++ i {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		} {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		} int start = 0; start 0 int end = numberS - 1; end numberS - 1 numberS 1 while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			} start <= end start end {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			} int target = start + (end - start) / 2; target start + (end - start) / 2 start (end - start) / 2 (end - start) end start 2 if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				} T[i] == S[target] T[i] T i S[target] S target {
					equalCount++;
					break;
				} equalCount++ equalCount break; if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				} T[i] > S[target] T[i] T i S[target] S target {
					start = target + 1;
				} start = target + 1 start target + 1 target 1 if(T[i] < S[target]) {
					end = target - 1;
				} T[i] < S[target] T[i] T i S[target] S target {
					end = target - 1;
				} end = target - 1 end target - 1 target 1 System.out.println(equalCount) System.out.println System.out System System.out equalCount String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] S = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            S[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] T = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			T[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {

			int start = 0;
			int end = numberS - 1;

			while(start <= end) {
				int target = start + (end - start) / 2;

				if(T[i] == S[target]) {
					equalCount++;
					break;
				} else if(T[i] > S[target]) {
					start = target + 1;
				} else if(T[i] < S[target]) {
					end = target - 1;
				}
			}
		}
		System.out.println(equalCount);
	}
}