
import java.util.*;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  }

  static void solve(Scanner sc) {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  }

  static int binarySearch(int[] arr, int target) {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  }
}
 import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  }

  static void solve(Scanner sc) {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  }

  static int binarySearch(int[] arr, int target) {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  }
} Main public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  } main {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  } try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    } {
      solve(sc);
    } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) solve(sc) solve sc String[] args args static void solve(Scanner sc) {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  } solve {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = new int[n]; S new int[n] n for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      S[i] = sc.nextInt();
    } {
      S[i] = sc.nextInt();
    } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int sum = 0; sum 0 for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    } {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    } if (binarySearch(S, sc.nextInt()) != -1)
        sum++; binarySearch(S, sc.nextInt()) != -1 binarySearch(S, sc.nextInt()) binarySearch S sc.nextInt() sc.nextInt sc -1 1 sum++ sum System.out.println(sum) System.out.println System.out System System.out sum Scanner sc sc static int binarySearch(int[] arr, int target) {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  } binarySearch {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  } int begin = 0; begin 0 int end = arr.length; end arr.length arr arr.length while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    } begin < end begin end {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    } int center = (begin + end) / 2; center (begin + end) / 2 (begin + end) begin end 2 if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      } arr[center] == target arr[center] arr center target {
        return center;
      } return center; center {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      } if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        } arr[center] > target arr[center] arr center target {
          end = center;// 前を探す
        } end = center end center {
          begin = center + 1;// 後ろを探す
        } begin = center + 1 begin center + 1 center 1 return -1; -1 1 int[] arr arr int target target public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  }

  static void solve(Scanner sc) {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  }

  static int binarySearch(int[] arr, int target) {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  }
} public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  }

  static void solve(Scanner sc) {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  }

  static int binarySearch(int[] arr, int target) {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  }
} Main

import java.util.*;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      solve(sc);
    }
  }

  static void solve(Scanner sc) {
    int n = sc.nextInt();
    int[] S = new int[n];
    for (int i = 0; i < n; i++) {
      S[i] = sc.nextInt();
    }

    int q = sc.nextInt();
    int sum = 0;
    for (int i = 0; i < q; i++) {
      if (binarySearch(S, sc.nextInt()) != -1)
        sum++;
    }

    System.out.println(sum);
  }

  static int binarySearch(int[] arr, int target) {
    // 探索範囲
    int begin = 0;
    int end = arr.length;

    while (begin < end) {
      int center = (begin + end) / 2;
      if (arr[center] == target) {
        return center;
      } else {
        if (arr[center] > target) {
          end = center;// 前を探す
        } else {
          begin = center + 1;// 後ろを探す
        }
      }
    }
    return -1;
  }
}

