import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}

} 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.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.LinkedList; LinkedList java.util import java.util.Set; Set java.util import java.util.StringTokenizer; StringTokenizer java.util import java.util.TreeMap; TreeMap java.util import java.util.TreeSet; TreeSet java.util public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}

} Main public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc Set<Integer> T = new TreeSet<Integer>(); T new TreeSet<Integer>() for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			T.add(sc.nextInt());
		} {
			T.add(sc.nextInt());
		} T.add(sc.nextInt()) T.add T sc.nextInt() sc.nextInt sc final int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		} {
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		} final int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc if(T.contains(t)){
				count++;
			} T.contains(t) T.contains T t {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	} Scanner private BufferedReader br; br private StringTokenizer tok; tok public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    } Scanner {
	        br = new BufferedReader(new InputStreamReader(is));
	    } br = new BufferedReader(new InputStreamReader(is)) br new BufferedReader(new InputStreamReader(is)) InputStream is is private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    } getLine {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    } while (!hasNext()) { tok = new StringTokenizer(br.readLine()); } !hasNext() hasNext() hasNext { tok = new StringTokenizer(br.readLine()); } tok = new StringTokenizer(br.readLine()) tok new StringTokenizer(br.readLine()) private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    } hasNext {
	        return tok != null && tok.hasMoreTokens();
	    } return tok != null && tok.hasMoreTokens(); tok != null && tok.hasMoreTokens() tok != null tok null tok.hasMoreTokens() tok.hasMoreTokens tok public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    } next {
	        getLine(); return tok.nextToken();
	    } getLine() getLine return tok.nextToken(); tok.nextToken() tok.nextToken tok public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    } nextInt {
	        return Integer.parseInt(next());
	    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    } nextLong {
	    	return Long.parseLong(next());
	    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public void close() throws IOException {
	        br.close();
	    } close {
	        br.close();
	    } br.close() br.close br public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}

} public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		Set<Integer> T = new TreeSet<Integer>();
		for(int i = 0; i < n; i++){
			T.add(sc.nextInt());
		}
		
		final int q = sc.nextInt();
		int count = 0;
		for(int i = 0; i < q; i++){
			final int t = sc.nextInt();
			
			if(T.contains(t)){
				count++;
			}
		}
		
		System.out.println(count);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}

}