import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

class Main {
	
	static class BinarySearch {
		public void binarysearch (InputReader ir) {
			
			int count = 0;
			int n = ir.nextInt();
			int[] array = new int[n];
			
			for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			}
			
			Arrays.sort(array);
			
			int q = ir.nextInt();
			int[] array2 = new int[q];
			
			for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			}
			 
			for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			}
			System.out.println(count);
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		BinarySearch obj = new BinarySearch ();
		obj.binarysearch (in);
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.InputMismatchException; InputMismatchException java.util import java.util.StringTokenizer; StringTokenizer java.util class Main {
	
	static class BinarySearch {
		public void binarysearch (InputReader ir) {
			
			int count = 0;
			int n = ir.nextInt();
			int[] array = new int[n];
			
			for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			}
			
			Arrays.sort(array);
			
			int q = ir.nextInt();
			int[] array2 = new int[q];
			
			for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			}
			 
			for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			}
			System.out.println(count);
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		BinarySearch obj = new BinarySearch ();
		obj.binarysearch (in);
	}
} Main public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		BinarySearch obj = new BinarySearch ();
		obj.binarysearch (in);
	} main {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		BinarySearch obj = new BinarySearch ();
		obj.binarysearch (in);
	} InputStream inputStream = System.in; inputStream System.in System System.in InputReader in = new InputReader (inputStream); in new InputReader (inputStream) BinarySearch obj = new BinarySearch (); obj new BinarySearch () obj.binarysearch (in) obj.binarysearch obj in String[] args args static class BinarySearch {
		public void binarysearch (InputReader ir) {
			
			int count = 0;
			int n = ir.nextInt();
			int[] array = new int[n];
			
			for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			}
			
			Arrays.sort(array);
			
			int q = ir.nextInt();
			int[] array2 = new int[q];
			
			for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			}
			 
			for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			}
			System.out.println(count);
		}
	} BinarySearch public void binarysearch (InputReader ir) {
			
			int count = 0;
			int n = ir.nextInt();
			int[] array = new int[n];
			
			for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			}
			
			Arrays.sort(array);
			
			int q = ir.nextInt();
			int[] array2 = new int[q];
			
			for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			}
			 
			for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			}
			System.out.println(count);
		} binarysearch {
			
			int count = 0;
			int n = ir.nextInt();
			int[] array = new int[n];
			
			for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			}
			
			Arrays.sort(array);
			
			int q = ir.nextInt();
			int[] array2 = new int[q];
			
			for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			}
			 
			for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			}
			System.out.println(count);
		} int count = 0; count 0 int n = ir.nextInt(); n ir.nextInt() ir.nextInt ir int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				array[i] = ir.nextInt();
			} {
				array[i] = ir.nextInt();
			} array[i] = ir.nextInt() array[i] array i ir.nextInt() ir.nextInt ir Arrays.sort(array) Arrays.sort Arrays array int q = ir.nextInt(); q ir.nextInt() ir.nextInt ir int[] array2 = new int[q]; array2 new int[q] q for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
				array2[i] = ir.nextInt();
			} {
				array2[i] = ir.nextInt();
			} array2[i] = ir.nextInt() array2[i] array2 i ir.nextInt() ir.nextInt ir for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			} {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			} int left = 0; left 0 int right = n; right n while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				} left < right left right {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				} int mid = (left + right)/2; mid (left + right)/2 (left + right) left right 2 if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1; array2[i] == array[mid] array2[i] array2 i array[mid] array mid {
						count++;
						break;
						} count++ count break; if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1; array2[i] < array[mid] array2[i] array2 i array[mid] array mid right = mid right mid left = mid + 1 left mid + 1 mid 1 System.out.println(count) System.out.println System.out System System.out count InputReader ir ir static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	} InputReader BufferedReader br; br StringTokenizer st; st public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		} nextString {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		} while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            } !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            } try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                } IOException e {
	                    throw new InputMismatchException();
	                } throw new InputMismatchException(); new InputMismatchException() {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } st = new StringTokenizer(br.readLine(), " ") st new StringTokenizer(br.readLine(), " ") return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
			return Integer.parseInt(nextString());
		} nextInt {
			return Integer.parseInt(nextString());
		} return Integer.parseInt(nextString()); Integer.parseInt(nextString()) Integer.parseInt Integer nextString() nextString public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		} InputReader {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		} br = new BufferedReader (new InputStreamReader (inputStream)) br new BufferedReader (new InputStreamReader (inputStream)) st = new StringTokenizer ("") st new StringTokenizer ("") InputStream inputStream inputStream
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

class Main {
	
	static class BinarySearch {
		public void binarysearch (InputReader ir) {
			
			int count = 0;
			int n = ir.nextInt();
			int[] array = new int[n];
			
			for (int i = 0; i < n; i++) {
				array[i] = ir.nextInt();
			}
			
			Arrays.sort(array);
			
			int q = ir.nextInt();
			int[] array2 = new int[q];
			
			for (int i = 0; i < q; i++) {
				array2[i] = ir.nextInt();
			}
			 
			for (int i = 0; i < q; i++) {
				int left = 0;
				int right = n;
		            		        
				while (left < right) {
					int mid = (left + right)/2;   
					if (array2[i] == array[mid]) {
						count++;
						break;
						}    
					else if (array2[i] < array[mid]) right = mid;    
					else left = mid + 1;
		            
				}    
			}
			System.out.println(count);
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		BinarySearch obj = new BinarySearch ();
		obj.binarysearch (in);
	}
}

