import java.util.Scanner;

/**
 * Created by akensho on 2015/11/23.
 */
public class Main {
    static int n, q;
    static int[] S, T;
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    }

    static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    }

    static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    }
    /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static int n, q;
    static int[] S, T;
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    }

    static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    }

    static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    }
    /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    }
} Main static int n n q; q static int[] S S T; T static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    } main {
        while (read()){
            System.out.println(solve());
        }
    } while (read()){
            System.out.println(solve());
        } read() read {
            System.out.println(solve());
        } System.out.println(solve()) System.out.println System.out System System.out solve() solve String[] args args static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    } read {
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    } if( !sc.hasNext() ) return false; !sc.hasNext() sc.hasNext() sc.hasNext sc return false; false n = sc.nextInt() n sc.nextInt() sc.nextInt sc S = new int[n] S new int[n] n for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < S.length i S.length S S.length i++ i++ i {
            S[i] = sc.nextInt();
        } {
            S[i] = sc.nextInt();
        } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc q = sc.nextInt() q sc.nextInt() sc.nextInt sc T = new int[q] T new int[q] q for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
            T[i] = sc.nextInt();
        } {
            T[i] = sc.nextInt();
        } T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc return true; true static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    } solve {
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    } int res = 0; res 0 for (int key : T){
            if( binarySearch(S, key) ) res++;
        } int key T {
            if( binarySearch(S, key) ) res++;
        } {
            if( binarySearch(S, key) ) res++;
        } if( binarySearch(S, key) ) res++; binarySearch(S, key) binarySearch S key res++ res return res; res /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    } binarySearch {
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    } int left = 0 left 0 right = targets.length; right targets.length targets targets.length while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        } left < right left right {
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        } int middle = (left+right)/2; middle (left+right)/2 (left+right) left right 2 if( targets[middle] == key ) {
                return true;
            } targets[middle] == key targets[middle] targets middle key {
                return true;
            } return true; true if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            } targets[middle] < key targets[middle] targets middle key {
                left = middle+1;
            } left = middle+1 left middle+1 middle 1 {
                right = middle;
            } right = middle right middle return false; false int[] targets targets int key key public class Main {
    static int n, q;
    static int[] S, T;
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    }

    static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    }

    static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    }
    /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    }
} public class Main {
    static int n, q;
    static int[] S, T;
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    }

    static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    }

    static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    }
    /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    }
} Main
import java.util.Scanner;

/**
 * Created by akensho on 2015/11/23.
 */
public class Main {
    static int n, q;
    static int[] S, T;
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    }

    static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    }

    static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    }
    /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    }
}