import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	}

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

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	}

} Main public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	} main {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	} Scanner cin=new Scanner(System.in); cin new Scanner(System.in) int n=cin.nextInt() n cin.nextInt() cin.nextInt cin T[]=new int[n]; T new int[n] n for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next()); int i=0; int i=0; i 0 i<n i n i++ i++ i T[i]=Integer.parseInt(cin.next()); T[i]=Integer.parseInt(cin.next()) T[i] T i Integer.parseInt(cin.next()) Integer.parseInt Integer cin.next() cin.next cin int q=cin.nextInt() q cin.nextInt() cin.nextInt cin res=0; res 0 for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		} {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		} int t=Integer.parseInt(cin.next()) t Integer.parseInt(cin.next()) Integer.parseInt Integer cin.next() cin.next cin s=0 s 0 m=(T.length-1)/2 m (T.length-1)/2 (T.length-1) T.length T T.length 1 2 g=T.length; g T.length T T.length while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			} g-s>=1 g-s g s 1 {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			} if(T[m]==t) {
					res++;
					break;
				} T[m]==t T[m] T m t {
					res++;
					break;
				} res++ res break; if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				} T[m]>t T[m] T m t {
					g=m;
					m=(s+g)/2;
				} g=m g m m=(s+g)/2 m (s+g)/2 (s+g) s g 2 if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				} T[m]<t T[m] T m t {
					s=m+1;
					m=(s+g)/2;
				} s=m+1 s m+1 m 1 m=(s+g)/2 m (s+g)/2 (s+g) s g 2 System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	}

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

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),T[]=new int[n];
		
		for(int i=0;i<n;i++)T[i]=Integer.parseInt(cin.next());
		
		int q=cin.nextInt(),res=0;
		for(int i=0;i<q;i++) {
			int t=Integer.parseInt(cin.next()),s=0,m=(T.length-1)/2,g=T.length;
			while(g-s>=1) {
				if(T[m]==t) {
					res++;
					break;
				}
				if(T[m]>t) {
					g=m;
					m=(s+g)/2;
				}
				else if(T[m]<t) {
					s=m+1;
					m=(s+g)/2;
				}
			}
		}
		System.out.println(res);
	}

}

