public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} Main public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  } run {
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  } java.util.Scanner sc = new java.util.Scanner(in); sc new java.util.Scanner(in) int n n q; q int[] s s t; t int i i j j c c l l r r a; a n = sc.nextInt() n sc.nextInt() sc.nextInt sc s = new int[n] s new int[n] n for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    } i = 0; 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 q = sc.nextInt() q sc.nextInt() sc.nextInt sc t = new int[q] t new int[q] q for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    } i = 0; 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 c = 0 c 0 for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    } i = 0; i = 0 i 0 i < q i q i++ i++ i {
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    } {
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    } l = 0 l 0 r = n - 1 r n - 1 n 1 for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      } ; l <= r l r {
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      } {
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      } a = (l + r) / 2 a (l + r) / 2 (l + r) l r 2 if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        } t[i] > s[a] t[i] t i s[a] s a {
          l = a + 1;
        } l = a + 1 l a + 1 a 1 if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        } t[i] < s[a] t[i] t i s[a] s a {
          r = a - 1;
        } r = a - 1 r a - 1 a 1 {
          c++;
          break;
        } c++ c break; System.out.println(c) System.out.println System.out System System.out c sc.close() sc.close sc java.io.InputStream in in java.io.PrintStream out out public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  } main {
    (new Main()).run(System.in, System.out);
  } (new Main()).run(System.in, System.out) (new Main()).run (new Main()) System.in System System.in System.out System System.out String[] args args public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} Main
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n, q;
    int[] s, t;
    int i, j, c, l, r, a;

    n = sc.nextInt();
    s = new int[n];
    for(i = 0;i < n;i++){
      s[i] = sc.nextInt();
    }
    q = sc.nextInt();
    t = new int[q];
    for(i = 0;i < q;i++){
      t[i] = sc.nextInt();
    }

    c = 0;
    for(i = 0;i < q;i++){
      l = 0;
      r = n - 1;
      for(;l <= r;){
        a = (l + r) / 2;
        if(t[i] > s[a]){
          l = a + 1;
        }else if(t[i] < s[a]){
          r = a - 1;
        }else{
          c++;
          break;
        }
      }
    }

    System.out.println(c);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}