import java.io.*;
import java.util.*;

public class Main {
	public ArrayList<Integer> S;
	public ArrayList<Integer> T;
	public int n;
	public int q;
	public int count = 0;
	public static void main(String[] args) {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	}
	public void init() {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void biSearch(int x, int left, int right) {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	}
	public void biSearch(int x) {
		biSearch(x, 0, S.size() - 1);
	}
}
 import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public ArrayList<Integer> S;
	public ArrayList<Integer> T;
	public int n;
	public int q;
	public int count = 0;
	public static void main(String[] args) {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	}
	public void init() {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void biSearch(int x, int left, int right) {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	}
	public void biSearch(int x) {
		biSearch(x, 0, S.size() - 1);
	}
} Main public ArrayList<Integer> S; S public ArrayList<Integer> T; T public int n; n public int q; q public int count = 0; count 0 public static void main(String[] args) {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	} main {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	} Main m = new Main(); m new Main() m.init() m.init m for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i)); int i = 0; int i = 0; i 0 i < m.q i m.q m m.q ++i ++i i m.biSearch(m.T.get(i)); m.biSearch(m.T.get(i)) m.biSearch m m.T.get(i) m.T.get m.T m m.T i System.out.println(m.count) System.out.println System.out System System.out m.count m m.count String[] args args public void init() {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} init {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	} try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) n = Integer.parseInt(reader.readLine()) n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader S = new ArrayList<>() S new ArrayList<>() StringTokenizer stS = new StringTokenizer(reader.readLine()); stS new StringTokenizer(reader.readLine()) while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken())); stS.hasMoreTokens() stS.hasMoreTokens stS S.add(Integer.parseInt(stS.nextToken())) S.add S Integer.parseInt(stS.nextToken()) Integer.parseInt Integer stS.nextToken() stS.nextToken stS q = Integer.parseInt(reader.readLine()) q Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader T = new ArrayList<>() T new ArrayList<>() StringTokenizer stT = new StringTokenizer(reader.readLine()); stT new StringTokenizer(reader.readLine()) while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken())); stT.hasMoreTokens() stT.hasMoreTokens stT T.add(Integer.parseInt(stT.nextToken())) T.add T Integer.parseInt(stT.nextToken()) Integer.parseInt Integer stT.nextToken() stT.nextToken stT private void biSearch(int x, int left, int right) {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	} biSearch {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	} int index = (left + right) / 2; index (left + right) / 2 (left + right) left right 2 if (x == S.get(index)) {
			++count;
			return;
		} x == S.get(index) x S.get(index) S.get S index {
			++count;
			return;
		} ++count count return; if (left > right)
			return; left > right left right return; if (x <= S.get(index))
			biSearch(x, left, index - 1); x <= S.get(index) x S.get(index) S.get S index biSearch(x, left, index - 1) biSearch x left index - 1 index 1 if (S.get(index) <= x)
			biSearch(x, index + 1, right); S.get(index) <= x S.get(index) S.get S index x biSearch(x, index + 1, right) biSearch x index + 1 index 1 right int x x int left left int right right public void biSearch(int x) {
		biSearch(x, 0, S.size() - 1);
	} biSearch {
		biSearch(x, 0, S.size() - 1);
	} biSearch(x, 0, S.size() - 1) biSearch x 0 S.size() - 1 S.size() S.size S 1 int x x public class Main {
	public ArrayList<Integer> S;
	public ArrayList<Integer> T;
	public int n;
	public int q;
	public int count = 0;
	public static void main(String[] args) {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	}
	public void init() {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void biSearch(int x, int left, int right) {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	}
	public void biSearch(int x) {
		biSearch(x, 0, S.size() - 1);
	}
} public class Main {
	public ArrayList<Integer> S;
	public ArrayList<Integer> T;
	public int n;
	public int q;
	public int count = 0;
	public static void main(String[] args) {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	}
	public void init() {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void biSearch(int x, int left, int right) {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	}
	public void biSearch(int x) {
		biSearch(x, 0, S.size() - 1);
	}
} Main
import java.io.*;
import java.util.*;

public class Main {
	public ArrayList<Integer> S;
	public ArrayList<Integer> T;
	public int n;
	public int q;
	public int count = 0;
	public static void main(String[] args) {
		Main m = new Main();
		m.init();
		for (int i = 0; i < m.q; ++i)
			m.biSearch(m.T.get(i));
		System.out.println(m.count);
	}
	public void init() {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			n = Integer.parseInt(reader.readLine());
			S = new ArrayList<>();
			StringTokenizer stS = new StringTokenizer(reader.readLine());
			while (stS.hasMoreTokens())
				S.add(Integer.parseInt(stS.nextToken()));
			q = Integer.parseInt(reader.readLine());
			T = new ArrayList<>();
			StringTokenizer stT = new StringTokenizer(reader.readLine());
			while (stT.hasMoreTokens())
				T.add(Integer.parseInt(stT.nextToken()));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void biSearch(int x, int left, int right) {
		int index = (left + right) / 2;
		if (x == S.get(index)) {
			++count;
			return;
		}
		if (left > right)
			return;
		if (x <= S.get(index))
			biSearch(x, left, index - 1);
		if (S.get(index) <= x)
			biSearch(x, index + 1, right);
	}
	public void biSearch(int x) {
		biSearch(x, 0, S.size() - 1);
	}
}

