import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    }
  
} import java.io.*; io.* java import java.util.*; util.* java import java.lang.Math; Math java.lang import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    }
  
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    } main {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = 0; n 0 n = sc.nextInt() n sc.nextInt() sc.nextInt sc int A[] = new int[n]; A new int[n] n for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc Arrays.sort(A) Arrays.sort Arrays A int ans = 0; ans 0 int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        } {
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        } int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc int ok = 0 ok 0 ng = n; ng n while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            } ng - ok > 1 ng - ok ng ok 1 {
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            } int mid = (ok + ng) / 2; mid (ok + ng) / 2 (ok + ng) ok ng 2 if(A[mid] <= m)ok = mid;
                else ng = mid; A[mid] <= m A[mid] A mid m ok = mid ok mid ng = mid ng mid if(A[ok] == m)ans++; A[ok] == m A[ok] A ok m ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    }
  
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    }
  
} Main
import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int n = 0;
        n = sc.nextInt();
        int A[] = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);

        int ans = 0;
        int q = sc.nextInt();
        for(int i = 0; i < q; i++){
            int m = sc.nextInt();
            int ok = 0, ng = n;
            while(ng - ok > 1){
                int mid = (ok + ng) / 2;
                if(A[mid] <= m)ok = mid;
                else ng = mid;
            }
            if(A[ok] == m)ans++;
        }
        System.out.println(ans);
    }
  
}
