
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i=0;i<n;i++){
			s[i] = in.nextInt();
		}
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i=0;i<q;i++){
			t[i] = in.nextInt();
		}
		int count = 0;
		for(int i=0;i<q;i++){
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		}
		System.out.println(count);
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i=0;i<n;i++){
			s[i] = in.nextInt();
		}
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i=0;i<q;i++){
			t[i] = in.nextInt();
		}
		int count = 0;
		for(int i=0;i<q;i++){
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i=0;i<n;i++){
			s[i] = in.nextInt();
		}
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i=0;i<q;i++){
			t[i] = in.nextInt();
		}
		int count = 0;
		for(int i=0;i<q;i++){
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		}
		System.out.println(count);
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i=0;i<n;i++){
			s[i] = in.nextInt();
		}
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i=0;i<q;i++){
			t[i] = in.nextInt();
		}
		int count = 0;
		for(int i=0;i<q;i++){
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		}
		System.out.println(count);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] s = new int[n]; s new int[n] n for(int i=0;i<n;i++){
			s[i] = in.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			s[i] = in.nextInt();
		} {
			s[i] = in.nextInt();
		} s[i] = in.nextInt() s[i] s i in.nextInt() in.nextInt in int q = in.nextInt(); q in.nextInt() in.nextInt in int[] t = new int[q]; t new int[q] q for(int i=0;i<q;i++){
			t[i] = in.nextInt();
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			t[i] = in.nextInt();
		} {
			t[i] = in.nextInt();
		} t[i] = in.nextInt() t[i] t i in.nextInt() in.nextInt in int count = 0; count 0 for(int i=0;i<q;i++){
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		} {
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		} int ul = s.length; ul s.length s s.length int ll = -1; ll -1 1 boolean flag = false; flag false while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			} ll+1<ul ll+1 ll 1 ul {
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			} int mid = (ll+ul)/2; mid (ll+ul)/2 (ll+ul) ll ul 2 if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				} s[mid] == t[i] s[mid] s mid t[i] t i {
					flag = true;
					break;
				} flag = true flag true break; if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				} s[mid]<t[i] s[mid] s mid t[i] t i {
					ll = mid;
				} ll = mid ll mid {
					ul = mid;
				} ul = mid ul mid if(flag){
				count++;
			} flag {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args

import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i=0;i<n;i++){
			s[i] = in.nextInt();
		}
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i=0;i<q;i++){
			t[i] = in.nextInt();
		}
		int count = 0;
		for(int i=0;i<q;i++){
			int ul = s.length;
			int ll = -1;
			boolean flag = false;
			while(ll+1<ul){
				int mid = (ll+ul)/2;
				if(s[mid] == t[i]){
					flag = true;
					break;
				}
				else if(s[mid]<t[i]){
					ll = mid;
				}
				else{
					ul = mid;
				}
			}
			if(flag){
				count++;
			}
		}
		System.out.println(count);
	}
}