import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
   
public class Main {
     
    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
     
    public void exec() throws IOException {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    }
    
    private int binarySearch(int[] S, int key, int from, int to) {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    }
}

class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
    public int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(br.readLine());
    }
     
    public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        }
        return a;
    }
 
     
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {
     
    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
     
    public void exec() throws IOException {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    }
    
    private int binarySearch(int[] S, int key, int from, int to) {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    }
} Main public static void main(String[] args) throws IOException {
        new Main().exec();
    } main {
        new Main().exec();
    } new Main().exec() new Main().exec new Main() String[] args args public void exec() throws IOException {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    } exec {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    } SimpleInputUtil in = new SimpleInputUtil(); in new SimpleInputUtil() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = in.readInt(); n in.readInt() in.readInt in int[] S = in.readIntArray(new int[n+1],n); S in.readIntArray(new int[n+1],n) in.readIntArray in new int[n+1] n+1 n 1 n int q = in.readInt(); q in.readInt() in.readInt in int[] T = in.readIntArray(new int[q],q); T in.readIntArray(new int[q],q) in.readIntArray in new int[q] q q int C = 0; C 0 for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
        	C += binarySearch(S, T[i], 0, n);
        } {
        	C += binarySearch(S, T[i], 0, n);
        } C += binarySearch(S, T[i], 0, n) C binarySearch(S, T[i], 0, n) binarySearch S T[i] T i 0 n out.println(C) out.println out C out.flush() out.flush out private int binarySearch(int[] S, int key, int from, int to) {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    } binarySearch {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    } if(from == to) return 0; from == to from to return 0; 0 int mid = (from + to) /2; mid (from + to) /2 (from + to) from to 2 if (key < S[mid]) 
    		return binarySearch(S,key,from,mid); key < S[mid] key S[mid] S mid return binarySearch(S,key,from,mid); binarySearch(S,key,from,mid) binarySearch S key from mid if (S[mid] < key)
			return binarySearch(S,key,mid+1,to); S[mid] < key S[mid] S mid key return binarySearch(S,key,mid+1,to); binarySearch(S,key,mid+1,to) binarySearch S key mid+1 mid 1 to return 1; 1 int[] S S int key key int from from int to to class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
    public int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(br.readLine());
    }
     
    public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        }
        return a;
    }
 
     
} SimpleInputUtil BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) public int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(br.readLine());
    } readInt {
        return Integer.parseInt(br.readLine());
    } return Integer.parseInt(br.readLine()); Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        }
        return a;
    } readIntArray {
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        }
        return a;
    } int i=0; i 0 while(i<num) {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        } i<num i num {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        } for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            } String s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " {
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            } {
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            } if(i<num) {
                    a[i++] = Integer.parseInt(s);
                } i<num i num {
                    a[i++] = Integer.parseInt(s);
                } a[i++] = Integer.parseInt(s) a[i++] a i++ i Integer.parseInt(s) Integer.parseInt Integer s return a; a int[] a a int num num public class Main {
     
    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
     
    public void exec() throws IOException {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    }
    
    private int binarySearch(int[] S, int key, int from, int to) {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    }
} public class Main {
     
    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
     
    public void exec() throws IOException {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    }
    
    private int binarySearch(int[] S, int key, int from, int to) {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
   
public class Main {
     
    public static void main(String[] args) throws IOException {
        new Main().exec();
    }
     
    public void exec() throws IOException {
        SimpleInputUtil in = new SimpleInputUtil();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.readInt();
        int[] S = in.readIntArray(new int[n+1],n);
        int q = in.readInt();
        int[] T = in.readIntArray(new int[q],q);
        int C = 0;
        for(int i=0; i<q; i++) {
        	C += binarySearch(S, T[i], 0, n);
        }
        out.println(C);
        out.flush();
    }
    
    private int binarySearch(int[] S, int key, int from, int to) {
    	if(from == to) return 0;
		int mid = (from + to) /2;
		if (key < S[mid]) 
    		return binarySearch(S,key,from,mid);
		if (S[mid] < key)
			return binarySearch(S,key,mid+1,to);
		return 1;
    }
}

class SimpleInputUtil {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
    public int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(br.readLine());
    }
     
    public int[] readIntArray(int[] a, int num) throws NumberFormatException, IOException{
        int i=0;
        while(i<num) {
            for(String s: br.readLine().split(" ")){
                if(i<num) {
                    a[i++] = Integer.parseInt(s);
                }
            }
        }
        return a;
    }
 
     
}