import java.io.*;

public class Main{

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

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
} import java.io.*; io.* java public class Main{

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

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
} Main static boolean binarySearch(int[] s, int n, int key){
        int left = 0;
        int right = n - 1;
        while(left <= right){
            int mid = (left + right) / 2;
            if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            }
        }

        return false;
    } binarySearch {
        int left = 0;
        int right = n - 1;
        while(left <= right){
            int mid = (left + right) / 2;
            if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            }
        }

        return false;
    } int left = 0; left 0 int right = n - 1; right n - 1 n 1 while(left <= right){
            int mid = (left + right) / 2;
            if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            }
        } left <= right left right {
            int mid = (left + right) / 2;
            if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            } s[mid] == key s[mid] s mid key {
                return true;
            } return true; true if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            } s[mid] < key s[mid] s mid key {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 if(key < s[mid]){
                right = mid - 1;
            } key < s[mid] key s[mid] s mid {
                right = mid - 1;
            } right = mid - 1 right mid - 1 mid 1 return false; false int[] s s int n n int key key public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        } catch(IOException e){
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        } int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str1 = br.readLine().split(" "); str1 br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] s = new int[n]; s new int[n] n for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]); int i = 0; int i = 0; i 0 i < n i n i++ i++ i s[i] = Integer.parseInt(str1[i]); s[i] = Integer.parseInt(str1[i]) s[i] s i Integer.parseInt(str1[i]) Integer.parseInt Integer str1[i] str1 i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str2 = br.readLine().split(" "); str2 br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] t = new int[q]; t new int[q] q for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]); int i = 0; int i = 0; i 0 i < q i q i++ i++ i t[i] = Integer.parseInt(str2[i]); t[i] = Integer.parseInt(str2[i]) t[i] t i Integer.parseInt(str2[i]) Integer.parseInt Integer str2[i] str2 i int count = 0; count 0 for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++; int i = 0; int i = 0; i 0 i < q i q i++ i++ i if(binarySearch(s, n, t[i]))
                count++; if(binarySearch(s, n, t[i]))
                count++; binarySearch(s, n, t[i]) binarySearch s n t[i] t i count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{

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

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
} public class Main{

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

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
} Main
import java.io.*;

public class Main{

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

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
