import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;

/**
 * @see <a href='http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?lang=jp&id='>??????</a>
 */
public class Main {
    private static FastReader in = new FastReader();

    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.run();
    }

    private void run() {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    }

    private boolean binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    }
}

class FastReader {
    private InputStream in = System.in;
    private byte[] buf = new byte[1024];
    private int charNum;
    private int charLen;
    private StringBuilder sb = new StringBuilder();

    public int read() {
        if (charLen == -1)
            throw new InputMismatchException();
        if (charNum >= charLen) {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        }
        return buf[charNum++];
    }

    public String next() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        sb.setLength(0);
        do {
            sb.appendCodePoint(c);
            c = read();
        } while (!isWhitespace(c));
        return sb.toString();
    }

    public char[] nextCharArray() {
        return next().toCharArray();
    }

    public int nextInt() {
        return (int) nextLong();
    }

    public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return array;
    }

    public List<Integer> nextIntList(int n) {
        Integer[] array = new Integer[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return Arrays.asList(array);
    }

    public int[][] nextIntArray2D(int n, int m) {
        int[][] array = new int[n][m];
        for (int i = 0; i < n; i++)
            array[i] = nextIntArray(m);
        return array;
    }

    public List<int[]> nextIntsList(int n, int m) {
        List<int[]> list = new ArrayList<int[]>(n);
        for (int i = 0; i < n; i++)
            list.add(nextIntArray(m));
        return list;
    }

    public long nextLong() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isWhitespace(c));
        return res * sgn;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();
        return array;
    }

    public boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
} import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.InputMismatchException; InputMismatchException java.util import java.util.List; List java.util public class Main {
    private static FastReader in = new FastReader();

    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.run();
    }

    private void run() {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    }

    private boolean binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    }
} Main private static FastReader in = new FastReader(); in new FastReader() public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.run();
    } main {
        Main main = new Main();
        main.run();
    } Main main = new Main(); main new Main() main.run() main.run main String[] args args private void run() {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    } run {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    } int n = in.nextInt(); n in.nextInt() in.nextInt in int[] s = in.nextIntArray(n); s in.nextIntArray(n) in.nextIntArray in n int q = in.nextInt(); q in.nextInt() in.nextInt in int[] t = in.nextIntArray(q); t in.nextIntArray(q) in.nextIntArray in q int count = 0; count 0 for (int target : t) {
            if (binarySearch(s, target)) count++;
        } int target t {
            if (binarySearch(s, target)) count++;
        } {
            if (binarySearch(s, target)) count++;
        } if (binarySearch(s, target)) count++; binarySearch(s, target) binarySearch s target count++ count System.out.println(count) System.out.println System.out System System.out count private boolean binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    } binarySearch {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    } int left = 0; left 0 int right = array.length; right array.length array array.length while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        } left < right left right {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 int temp = array[mid]; temp array[mid] array mid if (target < temp) {
                right = mid;
                continue;
            } target < temp target temp {
                right = mid;
                continue;
            } right = mid right mid continue; if (temp < target) {
                left = mid + 1;
                continue;
            } temp < target temp target {
                left = mid + 1;
                continue;
            } left = mid + 1 left mid + 1 mid 1 continue; return true; true return false; false int[] array array int target target class FastReader {
    private InputStream in = System.in;
    private byte[] buf = new byte[1024];
    private int charNum;
    private int charLen;
    private StringBuilder sb = new StringBuilder();

    public int read() {
        if (charLen == -1)
            throw new InputMismatchException();
        if (charNum >= charLen) {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        }
        return buf[charNum++];
    }

    public String next() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        sb.setLength(0);
        do {
            sb.appendCodePoint(c);
            c = read();
        } while (!isWhitespace(c));
        return sb.toString();
    }

    public char[] nextCharArray() {
        return next().toCharArray();
    }

    public int nextInt() {
        return (int) nextLong();
    }

    public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return array;
    }

    public List<Integer> nextIntList(int n) {
        Integer[] array = new Integer[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return Arrays.asList(array);
    }

    public int[][] nextIntArray2D(int n, int m) {
        int[][] array = new int[n][m];
        for (int i = 0; i < n; i++)
            array[i] = nextIntArray(m);
        return array;
    }

    public List<int[]> nextIntsList(int n, int m) {
        List<int[]> list = new ArrayList<int[]>(n);
        for (int i = 0; i < n; i++)
            list.add(nextIntArray(m));
        return list;
    }

    public long nextLong() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isWhitespace(c));
        return res * sgn;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();
        return array;
    }

    public boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
} FastReader private InputStream in = System.in; in System.in System System.in private byte[] buf = new byte[1024]; buf new byte[1024] 1024 private int charNum; charNum private int charLen; charLen private StringBuilder sb = new StringBuilder(); sb new StringBuilder() public int read() {
        if (charLen == -1)
            throw new InputMismatchException();
        if (charNum >= charLen) {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        }
        return buf[charNum++];
    } read {
        if (charLen == -1)
            throw new InputMismatchException();
        if (charNum >= charLen) {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        }
        return buf[charNum++];
    } if (charLen == -1)
            throw new InputMismatchException(); charLen == -1 charLen -1 1 throw new InputMismatchException(); new InputMismatchException() if (charNum >= charLen) {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        } charNum >= charLen charNum charLen {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        } charNum = 0 charNum 0 try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            } catch (IOException e) {
                throw new InputMismatchException();
            } IOException e {
                throw new InputMismatchException();
            } throw new InputMismatchException(); new InputMismatchException() {
                charLen = in.read(buf);
            } charLen = in.read(buf) charLen in.read(buf) in.read in buf if (charLen <= 0)
                return -1; charLen <= 0 charLen 0 return -1; -1 1 return buf[charNum++]; buf[charNum++] buf charNum++ charNum public String next() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        sb.setLength(0);
        do {
            sb.appendCodePoint(c);
            c = read();
        } while (!isWhitespace(c));
        return sb.toString();
    } next {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        sb.setLength(0);
        do {
            sb.appendCodePoint(c);
            c = read();
        } while (!isWhitespace(c));
        return sb.toString();
    } int c = read(); c read() read while (isWhitespace(c)) {
            c = read();
        } isWhitespace(c) isWhitespace c {
            c = read();
        } c = read() c read() read sb.setLength(0) sb.setLength sb 0 do {
            sb.appendCodePoint(c);
            c = read();
        } while (!isWhitespace(c)); !isWhitespace(c) isWhitespace(c) isWhitespace c {
            sb.appendCodePoint(c);
            c = read();
        } sb.appendCodePoint(c) sb.appendCodePoint sb c c = read() c read() read return sb.toString(); sb.toString() sb.toString sb public char[] nextCharArray() {
        return next().toCharArray();
    } nextCharArray {
        return next().toCharArray();
    } return next().toCharArray(); next().toCharArray() next().toCharArray next() next public int nextInt() {
        return (int) nextLong();
    } nextInt {
        return (int) nextLong();
    } return (int) nextLong(); (int) nextLong() nextLong public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return array;
    } nextIntArray {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return array;
    } int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++)
            array[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextInt(); array[i] = nextInt() array[i] array i nextInt() nextInt return array; array int n n public List<Integer> nextIntList(int n) {
        Integer[] array = new Integer[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return Arrays.asList(array);
    } nextIntList {
        Integer[] array = new Integer[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return Arrays.asList(array);
    } Integer[] array = new Integer[n]; array new Integer[n] n for (int i = 0; i < n; i++)
            array[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextInt(); array[i] = nextInt() array[i] array i nextInt() nextInt return Arrays.asList(array); Arrays.asList(array) Arrays.asList Arrays array int n n public int[][] nextIntArray2D(int n, int m) {
        int[][] array = new int[n][m];
        for (int i = 0; i < n; i++)
            array[i] = nextIntArray(m);
        return array;
    } nextIntArray2D {
        int[][] array = new int[n][m];
        for (int i = 0; i < n; i++)
            array[i] = nextIntArray(m);
        return array;
    } int[][] array = new int[n][m]; array new int[n][m] n m for (int i = 0; i < n; i++)
            array[i] = nextIntArray(m); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextIntArray(m); array[i] = nextIntArray(m) array[i] array i nextIntArray(m) nextIntArray m return array; array int n n int m m public List<int[]> nextIntsList(int n, int m) {
        List<int[]> list = new ArrayList<int[]>(n);
        for (int i = 0; i < n; i++)
            list.add(nextIntArray(m));
        return list;
    } nextIntsList {
        List<int[]> list = new ArrayList<int[]>(n);
        for (int i = 0; i < n; i++)
            list.add(nextIntArray(m));
        return list;
    } List<int[]> list = new ArrayList<int[]>(n); list new ArrayList<int[]>(n) for (int i = 0; i < n; i++)
            list.add(nextIntArray(m)); int i = 0; int i = 0; i 0 i < n i n i++ i++ i list.add(nextIntArray(m)); list.add(nextIntArray(m)) list.add list nextIntArray(m) nextIntArray m return list; list int n n int m m public long nextLong() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isWhitespace(c));
        return res * sgn;
    } nextLong {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isWhitespace(c));
        return res * sgn;
    } int c = read(); c read() read while (isWhitespace(c)) {
            c = read();
        } isWhitespace(c) isWhitespace c {
            c = read();
        } c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
            sgn = -1;
            c = read();
        } c == '-' c '-' {
            sgn = -1;
            c = read();
        } sgn = -1 sgn -1 1 c = read() c read() read long res = 0; res 0 do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isWhitespace(c)); !isWhitespace(c) isWhitespace(c) isWhitespace c {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } if (c < '0' || c > '9')
                throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public double nextDouble() {
        return Double.parseDouble(next());
    } nextDouble {
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();
        return array;
    } nextDoubleArray {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();
        return array;
    } double[] array = new double[n]; array new double[n] n for (int i = 0; i < n; i++)
            array[i] = nextDouble(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = nextDouble(); array[i] = nextDouble() array[i] array i nextDouble() nextDouble return array; array int n n public boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    } isWhitespace {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    } return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == '\t' c == '\r' c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == ' ' c ' ' c == '\n' c '\n' c == '\r' c '\r' c == '\t' c '\t' c == -1 c -1 1 int c c public class Main {
    private static FastReader in = new FastReader();

    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.run();
    }

    private void run() {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    }

    private boolean binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    }
} public class Main {
    private static FastReader in = new FastReader();

    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.run();
    }

    private void run() {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    }

    private boolean binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    }
} Main
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;

/**
 * @see <a href='http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?lang=jp&id='>??????</a>
 */
public class Main {
    private static FastReader in = new FastReader();

    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.run();
    }

    private void run() {
        int n = in.nextInt();
        int[] s = in.nextIntArray(n);
        int q = in.nextInt();
        int[] t = in.nextIntArray(q);

        int count = 0;
        for (int target : t) {
            if (binarySearch(s, target)) count++;
        }
        System.out.println(count);
    }

    private boolean binarySearch(int[] array, int target) {
        int left = 0;
        int right = array.length;
        while (left < right) {
            int mid = (left + right) / 2;
            int temp = array[mid];
            if (target < temp) {
                right = mid;
                continue;
            }
            if (temp < target) {
                left = mid + 1;
                continue;
            }
            return true;
        }
        return false;
    }
}

class FastReader {
    private InputStream in = System.in;
    private byte[] buf = new byte[1024];
    private int charNum;
    private int charLen;
    private StringBuilder sb = new StringBuilder();

    public int read() {
        if (charLen == -1)
            throw new InputMismatchException();
        if (charNum >= charLen) {
            charNum = 0;
            try {
                charLen = in.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (charLen <= 0)
                return -1;
        }
        return buf[charNum++];
    }

    public String next() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        sb.setLength(0);
        do {
            sb.appendCodePoint(c);
            c = read();
        } while (!isWhitespace(c));
        return sb.toString();
    }

    public char[] nextCharArray() {
        return next().toCharArray();
    }

    public int nextInt() {
        return (int) nextLong();
    }

    public int[] nextIntArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return array;
    }

    public List<Integer> nextIntList(int n) {
        Integer[] array = new Integer[n];
        for (int i = 0; i < n; i++)
            array[i] = nextInt();
        return Arrays.asList(array);
    }

    public int[][] nextIntArray2D(int n, int m) {
        int[][] array = new int[n][m];
        for (int i = 0; i < n; i++)
            array[i] = nextIntArray(m);
        return array;
    }

    public List<int[]> nextIntsList(int n, int m) {
        List<int[]> list = new ArrayList<int[]>(n);
        for (int i = 0; i < n; i++)
            list.add(nextIntArray(m));
        return list;
    }

    public long nextLong() {
        int c = read();
        while (isWhitespace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isWhitespace(c));
        return res * sgn;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public double[] nextDoubleArray(int n) {
        double[] array = new double[n];
        for (int i = 0; i < n; i++)
            array[i] = nextDouble();
        return array;
    }

    public boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
}