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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			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 void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} NumberFormatException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} IOException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} int lima = Integer.parseInt(in.readLine()); lima Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in String[] sa = in.readLine().split(" "); sa in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int limb = Integer.parseInt(in.readLine()); limb Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in String[] sb = in.readLine().split(" "); sb in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int[] a = new int[lima]; a new int[lima] lima int[] b = new int[limb]; b new int[limb] limb for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			} int i = 0; int i = 0; i 0 i < lima i lima i++ i++ i {
				a[i] = Integer.parseInt(sa[i]);
			} {
				a[i] = Integer.parseInt(sa[i]);
			} a[i] = Integer.parseInt(sa[i]) a[i] a i Integer.parseInt(sa[i]) Integer.parseInt Integer sa[i] sa i for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			} int i = 0; int i = 0; i 0 i < limb i limb i++ i++ i {
				b[i] = Integer.parseInt(sb[i]);
			} {
				b[i] = Integer.parseInt(sb[i]);
			} b[i] = Integer.parseInt(sb[i]) b[i] b i Integer.parseInt(sb[i]) Integer.parseInt Integer sb[i] sb i Arrays.sort(a) Arrays.sort Arrays a Arrays.sort(b) Arrays.sort Arrays b int hit = 0; hit 0 boolean[] flag = new boolean[limb]; flag new boolean[limb] limb for (int i = 0; i < limb; i++) {
				flag[i] = false;
			} int i = 0; int i = 0; i 0 i < limb i limb i++ i++ i {
				flag[i] = false;
			} {
				flag[i] = false;
			} flag[i] = false flag[i] flag i false for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			} int j = 0; int j = 0; j 0 j < limb j limb j++ j++ j {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			} {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			} if (flag[j]) continue; flag[j] flag j continue; int s = 0; s 0 int g = lima - 1; g lima - 1 lima 1 int i = (s + g) / 2; i (s + g) / 2 (s + g) s g 2 while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				} s <= g s g {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				} if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					} b[j] > a[i] b[j] b j a[i] a i {
						s = i + 1;
					} s = i + 1 s i + 1 i 1 if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					} b[j] == a[i] b[j] b j a[i] a i {
						flag[j] = true;
						hit++;
						break;
					} flag[j] = true flag[j] flag j true hit++ hit break; {
						g = i - 1;
					} g = i - 1 g i - 1 i 1 i = (s + g) / 2 i (s + g) / 2 (s + g) s g 2 System.out.println(hit) System.out.println System.out System System.out hit String[] args args public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    
		try {
			int lima = Integer.parseInt(in.readLine());
			String[] sa = in.readLine().split(" ");
			
			int limb = Integer.parseInt(in.readLine());
			String[] sb = in.readLine().split(" ");

			int[] a = new int[lima];
			int[] b = new int[limb];

			for (int i = 0; i < lima; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}
			
			for (int i = 0; i < limb; i++) {
				b[i] = Integer.parseInt(sb[i]);
			}
			
			Arrays.sort(a);
			Arrays.sort(b);
			
			int hit = 0;
			boolean[] flag = new boolean[limb];
			for (int i = 0; i < limb; i++) {
				flag[i] = false;
			}
			
			for (int j = 0; j < limb; j++) {
				if (flag[j]) continue;

				int s = 0;
				int g = lima - 1;	
				int i = (s + g) / 2;
				while (s <= g) {
					if (b[j] > a[i]) {
						s = i + 1;
					} else if (b[j] == a[i]) {
						flag[j] = true;
						hit++;
						break;
					} else {
						g = i - 1;
					}
					i = (s + g) / 2;
				}
			}
			
			System.out.println(hit);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}