import java.util.Scanner;
import java.util.ArrayList;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;

public class Main {
  private static int N;
  private static int[] S;
  private static int Q;
  private static int[] C;

  private static int binarySearch(int v, int low, int high) {
    if (low <= high) {
      int mid = (low + high) / 2;
      if (v > S[mid]) {
        return binarySearch(v, mid + 1, high);
      } else if (v < S[mid]){
        return binarySearch(v, low, mid - 1);
      } else if (v == S[mid]) {
        return v;
      }
    }
    return -1;
  }

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    N = in.nextInt();
    S = new int[N];
    for (int i = 0; i < N; i++) {
      S[i] = in.nextInt();
    }

    Q = in.nextInt();
    C = new int[N];
    for (int i = 0; i < Q; i++) {
      C[i] = in.nextInt();
    }

    int cnt = 0;
    for (int i = 0; i < Q; i++) {
      int ret = binarySearch(C[i], 0, N - 1);
      if (ret >= 0) {
        cnt++;
      }
    }

    System.out.println(cnt);
  }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz