
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    }

    private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    }

}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    }

    private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    }

} Main public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    } main {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    } BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) int n1 = Integer.parseInt(bf.readLine()); n1 Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf String[] sp1 = bf.readLine().split(" "); sp1 bf.readLine().split(" ") bf.readLine().split bf.readLine() bf.readLine bf " " int n2 = Integer.parseInt(bf.readLine()); n2 Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf String[] sp2 = bf.readLine().split(" "); sp2 bf.readLine().split(" ") bf.readLine().split bf.readLine() bf.readLine bf " " int sum = 0; sum 0 for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        } int j = 0; int j = 0; j 0 j < n2 j n2 j++ j++ j {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        } {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        } if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            } binarySearch(sp1, sp2[j], 0, n1-1) binarySearch sp1 sp2[j] sp2 j 0 n1-1 n1 1 {
                sum++;
            } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    } binarySearch {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (left > right) {
            return false;
        } left > right left right {
            return false;
        } return false; false if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        } key.equals(sp2[mid]) key.equals key sp2[mid] sp2 mid {
            return true;
        } return true; true if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        } Integer.parseInt(key) > Integer.parseInt(sp2[mid]) Integer.parseInt(key) Integer.parseInt Integer key Integer.parseInt(sp2[mid]) Integer.parseInt Integer sp2[mid] sp2 mid {
           return binarySearch(sp2, key, mid+1, right);
        } return binarySearch(sp2, key, mid+1, right); binarySearch(sp2, key, mid+1, right) binarySearch sp2 key mid+1 mid 1 right {
            return binarySearch(sp2, key, left, mid-1);
        } return binarySearch(sp2, key, left, mid-1); binarySearch(sp2, key, left, mid-1) binarySearch sp2 key left mid-1 mid 1 String sp2[] sp2 String key key int left left int right right public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    }

    private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    }

} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    }

    private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    }

} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    }

    private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    }

}

