import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    }
    System.out.println(count);
  }
}
 import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    }
    System.out.println(count);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        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 List<Integer> s = new ArrayList<>(); s new ArrayList<>() for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      s.add(sc.nextInt());
    } {
      s.add(sc.nextInt());
    } s.add(sc.nextInt()) s.add s sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc List<Integer> t = new ArrayList<>(); t new ArrayList<>() for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
      t.add(sc.nextInt());
    } {
      t.add(sc.nextInt());
    } t.add(sc.nextInt()) t.add t sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    } {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    } int left = 0; left 0 int right = n - 1; right n - 1 n 1 int middle = (left + right) / 2; middle (left + right) / 2 (left + right) left right 2 while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      } t.get(i).intValue() != s.get(middle).intValue() t.get(i).intValue() t.get(i).intValue t.get(i) t.get t i s.get(middle).intValue() s.get(middle).intValue s.get(middle) s.get s middle {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      } if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        } t.get(i) < s.get(middle) t.get(i) t.get t i s.get(middle) s.get s middle {
          right = middle - 1;
        } right = middle - 1 right middle - 1 middle 1 if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        } t.get(i) > s.get(middle) t.get(i) t.get t i s.get(middle) s.get s middle {
          left = middle + 1;
        } left = middle + 1 left middle + 1 middle 1 if(right < left) {
          break;
        } right < left right left {
          break;
        } break; middle = (left + right) / 2 middle (left + right) / 2 (left + right) left right 2 if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      } t.get(i).intValue() == s.get(middle).intValue() t.get(i).intValue() t.get(i).intValue t.get(i) t.get t i s.get(middle).intValue() s.get(middle).intValue s.get(middle) s.get s middle {
        count++;
      } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    }
    System.out.println(count);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    }
    System.out.println(count);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> s = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      s.add(sc.nextInt());
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      t.add(sc.nextInt());
    }
    int count = 0;
    for(int i = 0; i < q; i++) {
      int left = 0;
      int right = n - 1;
      int middle = (left + right) / 2;
      while(t.get(i).intValue() != s.get(middle).intValue()) {
        if(t.get(i) < s.get(middle)) {
          right = middle - 1;
        } else if(t.get(i) > s.get(middle)) {
          left = middle + 1;
        }
        if(right < left) {
          break;
        }
        middle = (left + right) / 2;
      }
      if(t.get(i).intValue() == s.get(middle).intValue()) {
        count++;
      }
    }
    System.out.println(count);
  }
}

