import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    }

} Main public static void main(String[] args) {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    } main {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    } Scanner tx = new Scanner(System.in); tx new Scanner(System.in) int a a b b c c cont = 0; cont 0 a = tx.nextInt() a tx.nextInt() tx.nextInt tx int arre[] = new int[a]; arre new int[a] a for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        } int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
            arre[i]=tx.nextInt();
        } {
            arre[i]=tx.nextInt();
        } arre[i]=tx.nextInt() arre[i] arre i tx.nextInt() tx.nextInt tx b = tx.nextInt() b tx.nextInt() tx.nextInt tx for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        } int i = 0; int i = 0; i 0 i < b i b i++ i++ i {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        } {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        } c=tx.nextInt() c tx.nextInt() tx.nextInt tx for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            } int j = 0; int j = 0; j 0 j < a j a j++ j++ j {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            } {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            } if (c==arre[j]) {
                    cont++;
                    break;
                    
                } c==arre[j] c arre[j] arre j {
                    cont++;
                    break;
                    
                } cont++ cont break; System.out.println(cont) System.out.println System.out System System.out cont String[] args args public class Main {

    public static void main(String[] args) {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    }

} public class Main {

    public static void main(String[] args) {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner tx = new Scanner(System.in);

        int a, b,c, cont = 0;

        a = tx.nextInt();
        int arre[] = new int[a];
        for (int i = 0; i < a; i++) {
            arre[i]=tx.nextInt();
        }
        b = tx.nextInt();
        for (int i = 0; i < b; i++) {
            c=tx.nextInt();
            for (int j = 0; j < a; j++) {
                if (c==arre[j]) {
                    cont++;
                    break;
                    
                }
            }
        }
        System.out.println(cont);

    }

}
