import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	} main {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	} BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in)); br 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 List<Integer> s = new ArrayList<>(); s new ArrayList<>() String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			s.add(Integer.parseInt(str[i]));
		} {
			s.add(Integer.parseInt(str[i]));
		} s.add(Integer.parseInt(str[i])) s.add s Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br List<Integer> t = new ArrayList<>(); t new ArrayList<>() str = br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			t.add(Integer.parseInt(str[i]));
		} {
			t.add(Integer.parseInt(str[i]));
		} t.add(Integer.parseInt(str[i])) t.add t Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int count = 0; count 0 for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		} Integer i t {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		} {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		} int left = 0; left 0 int right = s.size() - 1; right s.size() - 1 s.size() s.size s 1 int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			} left <= right left right {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			} if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				} i.intValue() == s.get(mid).intValue() i.intValue() i.intValue i s.get(mid).intValue() s.get(mid).intValue s.get(mid) s.get s mid {
					count++;
					break;
				} count++ count break; if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				} i.intValue() < s.get(mid).intValue() i.intValue() i.intValue i s.get(mid).intValue() s.get(mid).intValue s.get(mid) s.get s mid {
					right = mid - 1;
					mid = (left + right) / 2;
				} right = mid - 1 right mid - 1 mid 1 mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 {
					left = mid + 1;
					mid = (left + right) / 2;
				} left = mid + 1 left mid + 1 mid 1 mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		List<Integer> s = new ArrayList<>();
		String[] str = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s.add(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		List<Integer> t = new ArrayList<>();
		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			t.add(Integer.parseInt(str[i]));
		}
		int count = 0;
		for (Integer i : t) {
			int left = 0;
			int right = s.size() - 1;
			int mid = (left + right) / 2;
			while(left <= right) {
				if(i.intValue() == s.get(mid).intValue()) {
					count++;
					break;
				} else if (i.intValue() < s.get(mid).intValue()) {
					right = mid - 1;
					mid = (left + right) / 2;
				} else {
					left = mid + 1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
}
