import java.util.Scanner;

class Main {
  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();

    int[] elements = new int[size];
    for (int i = 0; i < size; i++) {
      elements[i] = sc.nextInt();
    }

    int searchSize = sc.nextInt();
    int[] searches = new int[searchSize];
    for (int i = 0; i < searchSize; i++) {
      searches[i] = sc.nextInt();
    }

    search(elements, searches);
  }

  public static void search(int[] elements, int[] searches) {
    int count = 0;
    int s;
    int l;
    int m;
    for (int search : searches) {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    }
    System.out.println(count);
  }
}
 import java.util.Scanner; Scanner java.util class Main {
  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();

    int[] elements = new int[size];
    for (int i = 0; i < size; i++) {
      elements[i] = sc.nextInt();
    }

    int searchSize = sc.nextInt();
    int[] searches = new int[searchSize];
    for (int i = 0; i < searchSize; i++) {
      searches[i] = sc.nextInt();
    }

    search(elements, searches);
  }

  public static void search(int[] elements, int[] searches) {
    int count = 0;
    int s;
    int l;
    int m;
    for (int search : searches) {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    }
    System.out.println(count);
  }
} Main public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();

    int[] elements = new int[size];
    for (int i = 0; i < size; i++) {
      elements[i] = sc.nextInt();
    }

    int searchSize = sc.nextInt();
    int[] searches = new int[searchSize];
    for (int i = 0; i < searchSize; i++) {
      searches[i] = sc.nextInt();
    }

    search(elements, searches);
  } main {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();

    int[] elements = new int[size];
    for (int i = 0; i < size; i++) {
      elements[i] = sc.nextInt();
    }

    int searchSize = sc.nextInt();
    int[] searches = new int[searchSize];
    for (int i = 0; i < searchSize; i++) {
      searches[i] = sc.nextInt();
    }

    search(elements, searches);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int size = sc.nextInt(); size sc.nextInt() sc.nextInt sc int[] elements = new int[size]; elements new int[size] size for (int i = 0; i < size; i++) {
      elements[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
      elements[i] = sc.nextInt();
    } {
      elements[i] = sc.nextInt();
    } elements[i] = sc.nextInt() elements[i] elements i sc.nextInt() sc.nextInt sc int searchSize = sc.nextInt(); searchSize sc.nextInt() sc.nextInt sc int[] searches = new int[searchSize]; searches new int[searchSize] searchSize for (int i = 0; i < searchSize; i++) {
      searches[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < searchSize i searchSize i++ i++ i {
      searches[i] = sc.nextInt();
    } {
      searches[i] = sc.nextInt();
    } searches[i] = sc.nextInt() searches[i] searches i sc.nextInt() sc.nextInt sc search(elements, searches) search elements searches String... args args public static void search(int[] elements, int[] searches) {
    int count = 0;
    int s;
    int l;
    int m;
    for (int search : searches) {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    }
    System.out.println(count);
  } search {
    int count = 0;
    int s;
    int l;
    int m;
    for (int search : searches) {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    }
    System.out.println(count);
  } int count = 0; count 0 int s; s int l; l int m; m for (int search : searches) {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    } int search searches {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    } {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    } s = 0 s 0 l = elements.length l elements.length elements elements.length while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      } true {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      } m = (s + l) / 2 m (s + l) / 2 (s + l) s l 2 if (elements[m]==search) {
          count++;
          break;
        } elements[m]==search elements[m] elements m search {
          count++;
          break;
        } count++ count break; if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        } search >= elements[m] search elements[m] elements m {
          s = m + 1;
        } s = m + 1 s m + 1 m 1 {
          l = m;
        } l = m l m if (s >= l) {
          break;
        } s >= l s l {
          break;
        } break; System.out.println(count) System.out.println System.out System System.out count int[] elements elements int[] searches searches
import java.util.Scanner;

class Main {
  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();

    int[] elements = new int[size];
    for (int i = 0; i < size; i++) {
      elements[i] = sc.nextInt();
    }

    int searchSize = sc.nextInt();
    int[] searches = new int[searchSize];
    for (int i = 0; i < searchSize; i++) {
      searches[i] = sc.nextInt();
    }

    search(elements, searches);
  }

  public static void search(int[] elements, int[] searches) {
    int count = 0;
    int s;
    int l;
    int m;
    for (int search : searches) {
      s = 0;
      l = elements.length;
      while (true) {
        m = (s + l) / 2;

        if (elements[m]==search) {
          count++;
          break;
        }

        if (search >= elements[m]) {
          s = m + 1;
        } else {
          l = m;
        }

        if (s >= l) {
          break;
        }
      }
    }
    System.out.println(count);
  }
}

