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

public class Main {
	public static int count = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	}
	
	public static void doBinarySearch(int[] s, int x) {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {
	public static int count = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	}
	
	public static void doBinarySearch(int[] s, int x) {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	}
} Main public static int count = 0; count 0 public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] sready = (br.readLine()).split(" "); sready (br.readLine()).split(" ") (br.readLine()).split (br.readLine()) br.readLine br " " int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]); int i = 0; int i = 0; i 0 i < n i n i++ i++ i s[i] = Integer.parseInt(sready[i]); s[i] = Integer.parseInt(sready[i]) s[i] s i Integer.parseInt(sready[i]) Integer.parseInt Integer sready[i] sready i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] tready = (br.readLine()).split(" "); tready (br.readLine()).split(" ") (br.readLine()).split (br.readLine()) br.readLine br " " int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]); int i = 0; int i = 0; i 0 i < q i q i++ i++ i t[i] = Integer.parseInt(tready[i]); t[i] = Integer.parseInt(tready[i]) t[i] t i Integer.parseInt(tready[i]) Integer.parseInt Integer tready[i] tready i for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]); int i = 0; int i = 0; i 0 i < q i q i++ i++ i doBinarySearch(s, t[i]); doBinarySearch(s, t[i]) doBinarySearch s t[i] t i pw.println(count) pw.println pw count pw.close() pw.close pw String[] args args public static void doBinarySearch(int[] s, int x) {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	} doBinarySearch {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	} int index1 = 0; index1 0 int index2 = s.length - 1; index2 s.length - 1 s.length s s.length 1 if (x < s[index1])
			return;
		else if (x > s[index2])
			return; x < s[index1] x s[index1] s index1 return; if (x > s[index2])
			return; x > s[index2] x s[index2] s index2 return; int point = (index2 - index1) / 2; point (index2 - index1) / 2 (index2 - index1) index2 index1 2 do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1); index2 - index1 > 1 index2 - index1 index2 index1 1 {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point; s[point] == x s[point] s point x {
				count++;
				break;
			} count++ count break; if (s[point] > x)
				index2 = point;
			else
				index1 = point; s[point] > x s[point] s point x index2 = point index2 point index1 = point index1 point point = index1 + (index2 - index1) / 2 point index1 + (index2 - index1) / 2 index1 (index2 - index1) / 2 (index2 - index1) index2 index1 2 if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		} index2 - index1 ==1 index2 - index1 index2 index1 1 {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		} if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++; s[index1] == x s[index1] s index1 x count++ count if (s[index2] == x)
				count++; s[index2] == x s[index2] s index2 x count++ count int[] s s int x x public class Main {
	public static int count = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	}
	
	public static void doBinarySearch(int[] s, int x) {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	}
} public class Main {
	public static int count = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	}
	
	public static void doBinarySearch(int[] s, int x) {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static int count = 0;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = Integer.parseInt(br.readLine());
		String[] sready = (br.readLine()).split(" ");
		int[] s = new int[n];
		for (int i = 0; i < n; i++)
			s[i] = Integer.parseInt(sready[i]);
		
		int q = Integer.parseInt(br.readLine());
		String[] tready = (br.readLine()).split(" ");
		int[] t = new int[q];
		for (int i = 0; i < q; i++)
			t[i] = Integer.parseInt(tready[i]);
		
		for (int i = 0; i < q; i++)
			doBinarySearch(s, t[i]);
		
		pw.println(count);
		pw.close();
	}
	
	public static void doBinarySearch(int[] s, int x) {
		int index1 = 0;
		int index2 = s.length - 1;
		if (x < s[index1])
			return;
		else if (x > s[index2])
			return;
		
		int point = (index2 - index1) / 2;
		do {
			if (s[point] == x) {
				count++;
				break;
			}
			else if (s[point] > x)
				index2 = point;
			else
				index1 = point;
			point = index1 + (index2 - index1) / 2;
		} while (index2 - index1 > 1);
		if (index2 - index1 ==1) {
			if (s[index1] == x)
				count++;
			else if (s[index2] == x)
				count++;
		}
	}
}