import java.util.*;
//import java.io.*;
//import static java.util.Arrays.*;
//import static java.util.Collections.*;
//import static java.lang.Math.*;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	}

} import java.util.*; util.* java import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	}

} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	} main {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	} int a a b b c c n n i i q q j j k; k k=0 k 0 Scanner scan=new Scanner(System.in); scan new Scanner(System.in) n=scan.nextInt() n scan.nextInt() scan.nextInt scan int s[]=new int [n]; s new int [n] n for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        } i=0; i=0 i 0 i<n i n i++ i++ i {
        	s[i]=scan.nextInt();
        } {
        	s[i]=scan.nextInt();
        } s[i]=scan.nextInt() s[i] s i scan.nextInt() scan.nextInt scan q=scan.nextInt() q scan.nextInt() scan.nextInt scan int t[]=new int [q]; t new int [q] q for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        } j=0; j=0 j 0 j<q j q j++ j++ j {
        	t[j]=scan.nextInt();
        } {
        	t[j]=scan.nextInt();
        } t[j]=scan.nextInt() t[j] t j scan.nextInt() scan.nextInt scan for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        } j=0; j=0 j 0 j<q j q j++ j++ j {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        } {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        } a=0 a 0 b=n b n while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        } a<b a b {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        } c=(a+b)/2 c (a+b)/2 (a+b) a b 2 if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	} s[c]==t[j] s[c] s c t[j] t j {
        		k++;
        		a=b+1;
        	} k++ k a=b+1 a b+1 b 1 if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	} s[c]>t[j] s[c] s c t[j] t j {
        		b=c;
        	} b=c b c {
        		a=c+1;
        	} a=c+1 a c+1 c 1 System.out.println(k) System.out.println System.out System System.out k String[] args args public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	}

} Main
import java.util.*;
//import java.io.*;
//import static java.util.Arrays.*;
//import static java.util.Collections.*;
//import static java.lang.Math.*;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int a,b,c,n,i,q,j,k;
        k=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
        	s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
        	t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
        a=0;
        b=n;
        while(a<b)
        {
        	c=(a+b)/2;
        	if(s[c]==t[j])
        	{
        		k++;
        		a=b+1;
        	}
        	else if(s[c]>t[j])
        	{
        		b=c;
        	}
        	else
        	{
        		a=c+1;
        	}
        }
        }
        System.out.println(k);
	}

}