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

public class Main {
	public static void main(String[] args) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	}

}
 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) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	}

} Main public static void main(String[] args) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	} main {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	} try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] tmp = br.readLine().split(" "); tmp 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(tmp[i]);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				s[i] = Integer.parseInt(tmp[i]);
			} {
				s[i] = Integer.parseInt(tmp[i]);
			} s[i] = Integer.parseInt(tmp[i]) s[i] s i Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br tmp = br.readLine().split(" ") tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int cnt = 0; cnt 0 for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			} {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			} int key = Integer.parseInt(tmp[i]); key Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i if (binarySearch(s, key) != -1) {
					cnt++;
				} binarySearch(s, key) != -1 binarySearch(s, key) binarySearch s key -1 1 {
					cnt++;
				} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	} binarySearch {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	} int left = 0; left 0 int right = s.length; right s.length s s.length int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		} left < right left right {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			} s[mid] == key s[mid] s mid key {
				return mid;
			} return mid; mid if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			} key < s[mid] key s[mid] s mid {
				right = mid;
			} right = mid right mid {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 return -1; -1 1 int[] s s int key key public class Main {
	public static void main(String[] args) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	}

} public class Main {
	public static void main(String[] args) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	}

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

public class Main {
	public static void main(String[] args) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	}

}

