import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.IOException;
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
 
public class Main {
    public static void main(String[] args) throws IOException {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util public class Main {
    public static void main(String[] args) throws IOException {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    }
} Main public static void main(String[] args) throws IOException {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    } main {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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] 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] t i sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt; int p t if(Arrays.binarySearch(s, p) >= 0) ++cnt; if(Arrays.binarySearch(s, p) >= 0) ++cnt; Arrays.binarySearch(s, p) >= 0 Arrays.binarySearch(s, p) Arrays.binarySearch Arrays s p 0 ++cnt cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    public static void main(String[] args) throws IOException {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.IOException;
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
 
public class Main {
    public static void main(String[] args) throws IOException {
         
        Scanner sc = new Scanner(System.in);
        
        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();
         
        int cnt = 0;
        for(int p : t)
            if(Arrays.binarySearch(s, p) >= 0) ++cnt;
        
        System.out.println(cnt);
    }
}
