import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	}

	public static boolean search(int[] targetArray, int aaa) {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	}

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

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	}

	public static boolean search(int[] targetArray, int aaa) {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	} main {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int arrayCnt = new Integer(s.nextLine()).intValue(); arrayCnt new Integer(s.nextLine()).intValue() new Integer(s.nextLine()).intValue new Integer(s.nextLine()) String[] tmp = s.nextLine().split(" "); tmp s.nextLine().split(" ") s.nextLine().split s.nextLine() s.nextLine s " " int[] targetArray = new int[arrayCnt]; targetArray new int[arrayCnt] arrayCnt for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		} int i=0 ; int i=0 ; i 0 i < arrayCnt i arrayCnt i++ i++ i {
			targetArray[i] = new Integer(tmp[i]).intValue();
		} {
			targetArray[i] = new Integer(tmp[i]).intValue();
		} targetArray[i] = new Integer(tmp[i]).intValue() targetArray[i] targetArray i new Integer(tmp[i]).intValue() new Integer(tmp[i]).intValue new Integer(tmp[i]) int cnt = new Integer(s.nextLine()).intValue(); cnt new Integer(s.nextLine()).intValue() new Integer(s.nextLine()).intValue new Integer(s.nextLine()) String[] aaa = s.nextLine().split(" "); aaa s.nextLine().split(" ") s.nextLine().split s.nextLine() s.nextLine s " " int existCnt = 0; existCnt 0 for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		} int i=0 ; int i=0 ; i 0 i<aaa.length i aaa.length aaa aaa.length i++ i++ i {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		} {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		} if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			} search(targetArray, new Integer(aaa[i]).intValue()) search targetArray new Integer(aaa[i]).intValue() new Integer(aaa[i]).intValue new Integer(aaa[i]) {
				existCnt++;
			} existCnt++ existCnt System.out.println(existCnt) System.out.println System.out System System.out existCnt String[] args args public static boolean search(int[] targetArray, int aaa) {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	} search {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	} int start = 0; start 0 int end = targetArray.length-1; end targetArray.length-1 targetArray.length targetArray targetArray.length 1 while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		} start <= end start end {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		} int mid = (start + end) / 2; mid (start + end) / 2 (start + end) start end 2 if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			} targetArray[mid] == aaa targetArray[mid] targetArray mid aaa return true; true if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			} targetArray[mid] < aaa targetArray[mid] targetArray mid aaa {
				start = mid + 1;
			} start = mid + 1 start mid + 1 mid 1 if(targetArray[mid] > aaa) {
				end = mid - 1;
			} targetArray[mid] > aaa targetArray[mid] targetArray mid aaa {
				end = mid - 1;
			} end = mid - 1 end mid - 1 mid 1 return false; false int[] targetArray targetArray int aaa aaa public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	}

	public static boolean search(int[] targetArray, int aaa) {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	}

	public static boolean search(int[] targetArray, int aaa) {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	}

} Main
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int arrayCnt = new Integer(s.nextLine()).intValue();
		String[] tmp = s.nextLine().split(" ");
		int[] targetArray = new int[arrayCnt];
		for(int i=0 ; i < arrayCnt ; i++) {
			targetArray[i] = new Integer(tmp[i]).intValue();
		}

		int cnt = new Integer(s.nextLine()).intValue();
		String[] aaa = s.nextLine().split(" ");
		int existCnt = 0;
		for(int i=0 ; i<aaa.length ; i++) {
			if(search(targetArray, new Integer(aaa[i]).intValue())) {
				existCnt++;
			}
		}
		System.out.println(existCnt);
	}

	public static boolean search(int[] targetArray, int aaa) {
		int start = 0;
		int end = targetArray.length-1;

		while(start <= end) {
			int mid = (start + end) / 2;
			if(targetArray[mid] == aaa)
				return true;
			else if(targetArray[mid] < aaa) {
				start = mid + 1;
			} else if(targetArray[mid] > aaa) {
				end = mid - 1;
			}
		}
		return false;
	}

}