import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main public static final int BIG_NUM  = 2000000000; BIG_NUM 2000000000 public static final int MOD  = 1000000007; MOD 1000000007 public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} NumberFormatException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String input[] = new String[N]; input new String[N] N input = br.readLine().split("\\s+") input br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" int S[] = new int[N]; S new int[N] N for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			} int i = 0; int i = 0; i 0 i < input.length i input.length input input.length i++ i++ i {
				S[i] = Integer.parseInt(input[i]);
			} {
				S[i] = Integer.parseInt(input[i]);
			} S[i] = Integer.parseInt(input[i]) S[i] S i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i int Q = Integer.parseInt(br.readLine()); Q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String inputQ[] = new String[Q]; inputQ new String[Q] Q inputQ = br.readLine().split("\\s+") inputQ br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" int T[] = new int[Q]; T new int[Q] Q for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			} int i = 0; int i = 0; i 0 i < inputQ.length i inputQ.length inputQ inputQ.length i++ i++ i {
				T[i] = Integer.parseInt(inputQ[i]);
			} {
				T[i] = Integer.parseInt(inputQ[i]);
			} T[i] = Integer.parseInt(inputQ[i]) T[i] T i Integer.parseInt(inputQ[i]) Integer.parseInt Integer inputQ[i] inputQ i Arrays.sort(T) Arrays.sort Arrays T int ans = 0; ans 0 int left = 0 left 0 right right m; m for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			} {
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			} right = S.length-1 right S.length-1 S.length S S.length 1 m = (left+right)/2 m (left+right)/2 (left+right) left right 2 while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				} left <= right left right {
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				} if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					} S[m] == T[i] S[m] S m T[i] T i {
						ans++;
						left = m;
						break;
					} ans++ ans left = m left m break; if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					} S[m] > T[i] S[m] S m T[i] T i {
						right = m-1;
					} right = m-1 right m-1 m 1 {
						left = m+1;
					} left = m+1 left m+1 m 1 m = (left+right)/2 m (left+right)/2 (left+right) left right 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int N = Integer.parseInt(br.readLine());
			String input[] = new String[N];
			input = br.readLine().split("\\s+");

			int S[] = new int[N];
			for(int i = 0; i < input.length; i++){
				S[i] = Integer.parseInt(input[i]);
			}

			int Q = Integer.parseInt(br.readLine());
			String inputQ[] = new String[Q];
			inputQ = br.readLine().split("\\s+");

			int T[] = new int[Q];
			for(int i = 0; i < inputQ.length; i++){
				T[i] = Integer.parseInt(inputQ[i]);
			}

			Arrays.sort(T);

			int ans = 0;
			int left = 0,right,m;

			for(int i = 0; i < T.length; i++){
				right = S.length-1;
				m = (left+right)/2;

				while(left <= right){
					if(S[m] == T[i]){
						ans++;
						left = m;
						break;
					}else if(S[m] > T[i]){
						right = m-1;
					}else{
						left = m+1;
					}
					m = (left+right)/2;
				}
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

