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);
  }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.lang.Integer; Integer java.lang import java.lang.StringBuilder; StringBuilder java.lang import java.lang.Math; Math java.lang 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);
  }
} Main private static int N; N private static int[] S; S private static int Q; Q private static int[] C; 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;
  } binarySearch {
    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;
  } 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;
      }
    } low <= high 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;
      }
    } int mid = (low + high) / 2; mid (low + high) / 2 (low + high) 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;
      } v > S[mid] v S[mid] S mid {
        return binarySearch(v, mid + 1, high);
      } return binarySearch(v, mid + 1, high); binarySearch(v, mid + 1, high) binarySearch v mid + 1 mid 1 high if (v < S[mid]){
        return binarySearch(v, low, mid - 1);
      } else if (v == S[mid]) {
        return v;
      } v < S[mid] v S[mid] S mid {
        return binarySearch(v, low, mid - 1);
      } return binarySearch(v, low, mid - 1); binarySearch(v, low, mid - 1) binarySearch v low mid - 1 mid 1 if (v == S[mid]) {
        return v;
      } v == S[mid] v S[mid] S mid {
        return v;
      } return v; v return -1; -1 1 int v v int low low int high high 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);
  } main {
    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);
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) N = in.nextInt() N in.nextInt() in.nextInt in S = new int[N] S new int[N] N for (int i = 0; i < N; i++) {
      S[i] = in.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      S[i] = in.nextInt();
    } {
      S[i] = in.nextInt();
    } S[i] = in.nextInt() S[i] S i in.nextInt() in.nextInt in Q = in.nextInt() Q in.nextInt() in.nextInt in C = new int[N] C new int[N] N for (int i = 0; i < Q; i++) {
      C[i] = in.nextInt();
    } int i = 0; int i = 0; i 0 i < Q i Q i++ i++ i {
      C[i] = in.nextInt();
    } {
      C[i] = in.nextInt();
    } C[i] = in.nextInt() C[i] C i in.nextInt() in.nextInt in int cnt = 0; cnt 0 for (int i = 0; i < Q; i++) {
      int ret = binarySearch(C[i], 0, N - 1);
      if (ret >= 0) {
        cnt++;
      }
    } int i = 0; int i = 0; i 0 i < Q i Q i++ i++ i {
      int ret = binarySearch(C[i], 0, N - 1);
      if (ret >= 0) {
        cnt++;
      }
    } {
      int ret = binarySearch(C[i], 0, N - 1);
      if (ret >= 0) {
        cnt++;
      }
    } int ret = binarySearch(C[i], 0, N - 1); ret binarySearch(C[i], 0, N - 1) binarySearch C[i] C i 0 N - 1 N 1 if (ret >= 0) {
        cnt++;
      } ret >= 0 ret 0 {
        cnt++;
      } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args 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);
  }
} 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);
  }
} Main
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);
  }
}