import java.util.Scanner;
public class Main {
  public static void main(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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  }
} Main public static void main(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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  } 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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  } 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 ans = 0; ans 0 for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    } {
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    } int left = -1; left -1 1 int right = n -1; right n -1 n 1 while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      } right - left > 1 right - left right left 1 {
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      } int mid = (left + right)/2; mid (left + right)/2 (left + right) left right 2 if(S[mid] >= T[i]) right = mid;
        else left = mid; S[mid] >= T[i] S[mid] S mid T[i] T i right = mid right mid left = mid left mid if(S[right] == T[i]) ans++; S[right] == T[i] S[right] S right T[i] T i ans++ ans System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
  public static void main(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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  }
} public class Main {
  public static void main(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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  }
} Main
import java.util.Scanner;
public class Main {
  public static void main(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 ans = 0;

    for(int i = 0; i < q; i++){
      int left = -1;
      int right = n -1;

      while(right - left > 1){
        int mid = (left + right)/2;
        
        if(S[mid] >= T[i]) right = mid;
        else left = mid;
      }
      
      if(S[right] == T[i]) ans++;
    }

    System.out.println(ans);

    sc.close();
  }
}
