import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = 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.nio.charset.StandardCharsets; StandardCharsets java.nio.charset public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
	
	
} Main public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	} main {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	} InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8); reader new InputStreamReader(System.in, StandardCharsets.UTF_8) BufferedReader in = new BufferedReader(reader); in new BufferedReader(reader) String s = in.readLine(); s in.readLine() in.readLine in int n = Integer.parseInt(s); n Integer.parseInt(s) Integer.parseInt Integer s s = in.readLine() s in.readLine() in.readLine in int[] a = new int[n]; a new int[n] n String[] as = s.split(" "); as s.split(" ") s.split s " " for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = Integer.parseInt(as[i]);
		} {
			a[i] = Integer.parseInt(as[i]);
		} a[i] = Integer.parseInt(as[i]) a[i] a i Integer.parseInt(as[i]) Integer.parseInt Integer as[i] as i s = in.readLine() s in.readLine() in.readLine in int q = Integer.parseInt(s); q Integer.parseInt(s) Integer.parseInt Integer s int[] t = new int[q]; t new int[q] q s = in.readLine() s in.readLine() in.readLine in as = s.split(" ") as s.split(" ") s.split s " " for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			t[i] = Integer.parseInt(as[i]);
		} {
			t[i] = Integer.parseInt(as[i]);
		} t[i] = Integer.parseInt(as[i]) t[i] t i Integer.parseInt(as[i]) Integer.parseInt Integer as[i] as i int count = 0; count 0 for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		} {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		} int left = 0; left 0 int right = n-1; right n-1 n 1 int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			} left <= right left right {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			} if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				} a[mid] == t[i] a[mid] a mid t[i] t i {
					count++;
					break;
				} count++ count break; if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				} a[mid] < t[i] a[mid] a mid t[i] t i {
					 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 if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				} a[mid] > t[i] a[mid] a mid t[i] t i {
					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 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 {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
	
	
} public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = 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.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
	
	
}
