import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean binarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.regex.Pattern; Pattern java.util.regex public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean binarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = ip(br.readLine()); n ip(br.readLine()) ip br.readLine() br.readLine br int[] s = createListInt(br.readLine()); s createListInt(br.readLine()) createListInt br.readLine() br.readLine br int q = ip(br.readLine()); q ip(br.readLine()) ip br.readLine() br.readLine br int[] t = createListInt(br.readLine()); t createListInt(br.readLine()) createListInt br.readLine() br.readLine br int count = 0; count 0 for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if (binarySearch(s, t[i])) {
                count++;
            }
        } {
            if (binarySearch(s, t[i])) {
                count++;
            }
        } if (binarySearch(s, t[i])) {
                count++;
            } binarySearch(s, t[i]) binarySearch s t[i] t i {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args static boolean binarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    } binarySearch {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    } int left = 0; left 0 int right = a.length; right a.length a a.length while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        } left < right left right {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            } a[mid] == key a[mid] a mid key {
                return true;
            } return true; true if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            } key < a[mid] key a[mid] a mid {
                right = mid;
            } right = mid right mid {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 return false; false int[] a a int key key static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    } isNumber {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    } return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find(); Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find() Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num) Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$") Pattern.compile Pattern "^\\-?[0-9]*\\.?[0-9]+$" num String num num static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    } createListInt {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    } String[] lines = line.split(" "); lines line.split(" ") line.split line " " int n = lines.length; n lines.length lines lines.length int[] list = new int[n]; list new int[n] n while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        } n-- > 0 n-- n 0 {
            list[n] = Integer.parseInt(lines[n]);
        } list[n] = Integer.parseInt(lines[n]) list[n] list n Integer.parseInt(lines[n]) Integer.parseInt Integer lines[n] lines n return list; list String line line static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    } createListLong {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    } String[] lines = line.split(" "); lines line.split(" ") line.split line " " int n = lines.length; n lines.length lines lines.length long[] list = new long[n]; list new long[n] n while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        } n-- > 0 n-- n 0 {
            list[n] = Long.parseLong(lines[n]);
        } list[n] = Long.parseLong(lines[n]) list[n] list n Long.parseLong(lines[n]) Long.parseLong Long lines[n] lines n return list; list String line line static int ip(String s) {
        return Integer.parseInt(s);
    } ip {
        return Integer.parseInt(s);
    } return Integer.parseInt(s); Integer.parseInt(s) Integer.parseInt Integer s String s s static long lp(String s) {
        return Long.parseLong(s);
    } lp {
        return Long.parseLong(s);
    } return Long.parseLong(s); Long.parseLong(s) Long.parseLong Long s String s s public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean binarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean binarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] s = createListInt(br.readLine());
        int q = ip(br.readLine());
        int[] t = createListInt(br.readLine());
        int count = 0;
        // Arrays.sort(s);
        for (int i = 0; i < q; i++) {
            if (binarySearch(s, t[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean binarySearch(int[] a, int key) {
        int left = 0;
        int right = a.length;
        while (left < right) {
            int mid = (left + right) / 2;
            if (a[mid] == key) {
                return true;
            } else if (key < a[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return false;
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
}