
import java.util.*;

/**
 * A
 */
public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    }
} Main public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    } main {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int flag = 0 flag 0 count = 0 count 0 left left right; right int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = new int[n]; S new int[n] n for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            S[i] = sc.nextInt();
        } {
            S[i] = sc.nextInt();
        } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i<q i q i++ i++ i {
            T[i] = sc.nextInt();
        } {
            T[i] = sc.nextInt();
        } T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc sc.close() sc.close sc for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        } int i=0; int i=0; i 0 i<q i q i++ i++ i {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        } {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        } int key = T[i]; key T[i] T i flag = 0 flag 0 left = 0 left 0 right = S.length right S.length S S.length while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            } left<right left right {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            } int mid = (left+right)/2; mid (left+right)/2 (left+right) left right 2 if(key == S[mid]) {
                    flag++;
                    break;
                } key == S[mid] key S[mid] S mid {
                    flag++;
                    break;
                } flag++ flag break; if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                } key > S[mid] key S[mid] S mid {
                    left = mid+1;
                } left = mid+1 left mid+1 mid 1 if(key < S[mid]) {
                    right = mid;
                } key < S[mid] key S[mid] S mid {
                    right = mid;
                } right = mid right mid if(flag >= 1) {
                count++;
            } flag >= 1 flag 1 {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    }
} public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    }
} Main

import java.util.*;

/**
 * A
 */
public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int flag = 0, count = 0, left, right;

        int n = sc.nextInt();
        int[] S = new int[n];

        for(int i=0; i<n; i++) {
            S[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] T = new int[q];

        for (int i = 0; i<q; i++) {
            T[i] = sc.nextInt();
        }

        sc.close();

        for(int i=0; i<q; i++) {

            int key = T[i];
            flag = 0;
            left = 0;
            right = S.length;

            while(left<right) {

                int mid = (left+right)/2;

                if(key == S[mid]) {
                    flag++;
                    break;
                }

                if(key > S[mid]) {
                    left = mid+1;
                } else if(key < S[mid]) {
                    right = mid;
                }

            }

            if(flag >= 1) {
                count++;
            }

        }

        System.out.println(count);

    }
}
