import 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();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      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();
    int[] s = new int[n];
    for(int i = 0; i < n; i++) {
      s[i] = sc.nextInt();
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      count++;
    }
    System.out.println(count);
  }
} 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();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      count++;
    }
    System.out.println(count);
  } 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();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      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 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 List<Integer> t = new ArrayList<>(); t new ArrayList<>() for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    } {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(!t.contains(a)) {
        t.add(a);
      } !t.contains(a) t.contains(a) t.contains t a {
        t.add(a);
      } t.add(a) t.add t a int count = 0; count 0 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();
    int[] s = new int[n];
    for(int i = 0; i < n; i++) {
      s[i] = sc.nextInt();
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      count++;
    }
    System.out.println(count);
  }
} 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();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      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();
    int[] s = new int[n];
    for(int i = 0; i < n; i++) {
      s[i] = sc.nextInt();
    }
    int q = sc.nextInt();
    List<Integer> t = new ArrayList<>();
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      if(!t.contains(a)) {
        t.add(a);
      }
    }
    int count = 0;
    loop: for(int i = 0; i < t.size(); i++) {
      int key = t.get(i);
      int left = 0;
      int right = n - 1;
      int middle = n / 2;
      while(key != s[middle]) {
        if(key < s[middle]) {
          right = middle - 1;
          middle = (left + right) / 2;
        } else {
          left = middle + 1;
          middle = (left + right) / 2;
        }
        if(left > right) {
          continue loop;
        }
      }
      count++;
    }
    System.out.println(count);
  }
}

