import java.util.Scanner;

public class Main {
  public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  }

  private static boolean binarySearch(int[] S, int key) {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  }

  private static boolean binarySearch(int[] S, int key) {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  }
} Main public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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[] T = new int[q]; T new int[q] q for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
      T[i] = sc.nextInt();
    } {
      T[i] = sc.nextInt();
    } T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    } int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
      if (binarySearch(S, T[i]))
        count++;
    } {
      if (binarySearch(S, T[i]))
        count++;
    } if (binarySearch(S, T[i]))
        count++; binarySearch(S, T[i]) binarySearch S T[i] T i count++ count System.out.println(count) System.out.println System.out System System.out count final String[] args args private static boolean binarySearch(int[] S, int key) {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  } binarySearch {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  } int left = 0; left 0 int right = S.length - 1; right S.length - 1 S.length S S.length 1 int mid; mid while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    } left <= right left right {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    } mid = (right + left) / 2 mid (right + left) / 2 (right + left) right left 2 if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      } S[mid] == key S[mid] S mid key {
        return true;
      } return true; true if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      } S[mid] < key S[mid] S mid key {
        left = mid + 1;
      } left = mid + 1 left mid + 1 mid 1 if (S[mid] > key) {
        right = mid - 1;
      } S[mid] > key S[mid] S mid key {
        right = mid - 1;
      } right = mid - 1 right mid - 1 mid 1 return false; false int[] S S int key key public class Main {
  public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  }

  private static boolean binarySearch(int[] S, int key) {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  }
} public class Main {
  public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  }

  private static boolean binarySearch(int[] S, int key) {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(final String[] args) {
    Scanner sc = new Scanner(System.in);
    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[] T = new int[q];
    for (int i = 0; i < q; i++) {
      T[i] = sc.nextInt();
    }
    int count = 0;
    for (int i = 0; i < T.length; i++) {
      if (binarySearch(S, T[i]))
        count++;
    }
    System.out.println(count);
  }

  private static boolean binarySearch(int[] S, int key) {
    int left = 0;
    int right = S.length - 1;
    int mid;
    while (left <= right) {
      mid = (right + left) / 2;
      if (S[mid] == key) {
        return true;
      } else if (S[mid] < key) {
        left = mid + 1;
      } else if (S[mid] > key) {
        right = mid - 1;
      }
    }
    return false;
  }
}
