import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Arrays;

/*Question
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°???????????????????????????????????? 
*/

/*Input
???????????? n??????????????? S ?????¨??? n ????????´??°??????????????? q??????????????? T ?????¨??? q ????????´??°???????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.HashSet; HashSet java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] tmp = br.readLine().split(" "); tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] s = new int[n]; s new int[n] n for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		} int a = 0; int a = 0; a 0 a < n a n a++ a++ a {
			s[a] = Integer.parseInt(tmp[a]);
		} {
			s[a] = Integer.parseInt(tmp[a]);
		} s[a] = Integer.parseInt(tmp[a]) s[a] s a Integer.parseInt(tmp[a]) Integer.parseInt Integer tmp[a] tmp a n = Integer.parseInt(br.readLine()) n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br tmp = br.readLine().split(" ") tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] t = new int[n]; t new int[n] n for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		} int a = 0; int a = 0; a 0 a < n a n a++ a++ a {
			t[a] = Integer.parseInt(tmp[a]);
		} {
			t[a] = Integer.parseInt(tmp[a]);
		} t[a] = Integer.parseInt(tmp[a]) t[a] t a Integer.parseInt(tmp[a]) Integer.parseInt Integer tmp[a] tmp a int len; len int b = 0; b 0 int count = 0; count 0 Arrays.sort(s) Arrays.sort Arrays s Arrays.sort(t) Arrays.sort Arrays t for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		} int a = 0; int a = 0; a 0 a < t.length a t.length t t.length a++ a++ a {
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		} {
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		} while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			} b < s.length b s.length s s.length {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			} if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				} t[a] < s[b] t[a] t a s[b] s b {
					break;
				} break; if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				} t[a] == s[b] t[a] t a s[b] s b {
					count++;
					len = b;
					break;
				} count++ count len = b len b break; b++ b System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.util.Arrays;

/*Question
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°???????????????????????????????????? 
*/

/*Input
???????????? n??????????????? S ?????¨??? n ????????´??°??????????????? q??????????????? T ?????¨??? q ????????´??°???????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		//??\???

		int n = Integer.parseInt(br.readLine());
		String[] tmp = br.readLine().split(" ");
		int[] s = new int[n];
		for (int a = 0;a < n;a++){
			s[a] = Integer.parseInt(tmp[a]);
		}
		n = Integer.parseInt(br.readLine());
		tmp = br.readLine().split(" ");
		int[] t = new int[n];
		for (int a = 0;a < n;a++){
			t[a] = Integer.parseInt(tmp[a]);
		}

		//?¨??????¨
		int len; //??????????????????????¨????
		int b = 0;

		//????????¨ - ?????´?????????????????°????¨????
		int count = 0;

		//??´?????????
		Arrays.sort(s);
		Arrays.sort(t);

		/*????????????????????????
		/????????????????????´?????\?????§??¢?´¢??????????????????????????¨??????????????????????????£???
		*/
		for (int a = 0;a < t.length;a++){
			while (b < s.length) {
				if (t[a] < s[b]) {
					break;
				} else if (t[a] == s[b]) {
					count++;
					len = b;
					break;
				}
				b++;
			}
		}

		//??????
		System.out.println(count);
	}
}