import java.util.*;
import java.io.*;

class Main {
    static boolean binary(int key, int[] s) {
        int left = 0;
        int right = s.length;
        int mid = 0;
        int count = 0;
        while( left < right) {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        }
        return false;
    }
    public static void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        int sSize = Integer.parseInt(br.readLine());
        String[] sStr = br.readLine().split(" ");
        int[] s = new int[sSize];
        for(int i = 0; i < sSize; i++) {
            s[i] = Integer.parseInt(sStr[i]);
        }

        int tSize = Integer.parseInt(br.readLine());
        String[] tStr = br.readLine().split(" ");

        for(int n = 0; n < tSize; n++) {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            }
        System.out.println(count);
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    static boolean binary(int key, int[] s) {
        int left = 0;
        int right = s.length;
        int mid = 0;
        int count = 0;
        while( left < right) {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        }
        return false;
    }
    public static void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        int sSize = Integer.parseInt(br.readLine());
        String[] sStr = br.readLine().split(" ");
        int[] s = new int[sSize];
        for(int i = 0; i < sSize; i++) {
            s[i] = Integer.parseInt(sStr[i]);
        }

        int tSize = Integer.parseInt(br.readLine());
        String[] tStr = br.readLine().split(" ");

        for(int n = 0; n < tSize; n++) {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            }
        System.out.println(count);
    }
} Main static boolean binary(int key, int[] s) {
        int left = 0;
        int right = s.length;
        int mid = 0;
        int count = 0;
        while( left < right) {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        }
        return false;
    } binary {
        int left = 0;
        int right = s.length;
        int mid = 0;
        int count = 0;
        while( left < right) {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        }
        return false;
    } int left = 0; left 0 int right = s.length; right s.length s s.length int mid = 0; mid 0 int count = 0; count 0 while( left < right) {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        } left < right left right {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        } mid = (left + right)/2 mid (left + right)/2 (left + right) left right 2 if(s[mid] == key) {
            return true;
            } s[mid] == key s[mid] s mid key {
            return true;
            } return true; true if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            } s[mid] > key s[mid] s mid key {
                 right = mid;
            } right = mid right mid {
                 left = ++mid;
            } left = ++mid left ++mid mid return false; false int key key int[] s s public static void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        int sSize = Integer.parseInt(br.readLine());
        String[] sStr = br.readLine().split(" ");
        int[] s = new int[sSize];
        for(int i = 0; i < sSize; i++) {
            s[i] = Integer.parseInt(sStr[i]);
        }

        int tSize = Integer.parseInt(br.readLine());
        String[] tStr = br.readLine().split(" ");

        for(int n = 0; n < tSize; n++) {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            }
        System.out.println(count);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        int sSize = Integer.parseInt(br.readLine());
        String[] sStr = br.readLine().split(" ");
        int[] s = new int[sSize];
        for(int i = 0; i < sSize; i++) {
            s[i] = Integer.parseInt(sStr[i]);
        }

        int tSize = Integer.parseInt(br.readLine());
        String[] tStr = br.readLine().split(" ");

        for(int n = 0; n < tSize; n++) {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            }
        System.out.println(count);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int count = 0; count 0 int sSize = Integer.parseInt(br.readLine()); sSize Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] sStr = br.readLine().split(" "); sStr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] s = new int[sSize]; s new int[sSize] sSize for(int i = 0; i < sSize; i++) {
            s[i] = Integer.parseInt(sStr[i]);
        } int i = 0; int i = 0; i 0 i < sSize i sSize i++ i++ i {
            s[i] = Integer.parseInt(sStr[i]);
        } {
            s[i] = Integer.parseInt(sStr[i]);
        } s[i] = Integer.parseInt(sStr[i]) s[i] s i Integer.parseInt(sStr[i]) Integer.parseInt Integer sStr[i] sStr i int tSize = Integer.parseInt(br.readLine()); tSize Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] tStr = br.readLine().split(" "); tStr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int n = 0; n < tSize; n++) {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            } int n = 0; int n = 0; n 0 n < tSize n tSize n++ n++ n {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            } {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            } int key = Integer.parseInt(tStr[n]); key Integer.parseInt(tStr[n]) Integer.parseInt Integer tStr[n] tStr n if(binary(key, s)) {
            count++;
            } binary(key, s) binary key s {
            count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String...args args
import java.util.*;
import java.io.*;

class Main {
    static boolean binary(int key, int[] s) {
        int left = 0;
        int right = s.length;
        int mid = 0;
        int count = 0;
        while( left < right) {
            mid = (left + right)/2;
            if(s[mid] == key) {
            return true;
            }
             if (s[mid] > key) {
                 right = mid;
            } else {
                 left = ++mid;
            }
        }
        return false;
    }
    public static void main(String...args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count = 0;
        int sSize = Integer.parseInt(br.readLine());
        String[] sStr = br.readLine().split(" ");
        int[] s = new int[sSize];
        for(int i = 0; i < sSize; i++) {
            s[i] = Integer.parseInt(sStr[i]);
        }

        int tSize = Integer.parseInt(br.readLine());
        String[] tStr = br.readLine().split(" ");

        for(int n = 0; n < tSize; n++) {
            int key = Integer.parseInt(tStr[n]);
            if(binary(key, s)) {
            count++;
            }             
            }
        System.out.println(count);
    }
}
