import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  }
} Main public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  } main {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  } try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    } {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] seqS = new int[n]; seqS new int[n] n String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i seqS[i] = Integer.parseInt(line[i]); seqS[i] = Integer.parseInt(line[i]) seqS[i] seqS i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br line = br.readLine().split(" ") line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int cnt=0; cnt 0 for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      } String ref line {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      } {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      } if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++; isExistSeachByBinary(seqS, Integer.parseInt(ref)) isExistSeachByBinary seqS Integer.parseInt(ref) Integer.parseInt Integer ref cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  } isExistSeachByBinary {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  } int left = 0; left 0 int right= tar.length; right tar.length tar tar.length int mid; mid while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    } left < right left right {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    } mid  = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1; tar[mid] == ref tar[mid] tar mid ref return true; true if( tar[mid] > ref ) right = mid;
      else left = mid + 1; tar[mid] > ref tar[mid] tar mid ref right = mid right mid left = mid + 1 left mid + 1 mid 1 return false; false int[] tar tar int ref ref public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  }
} public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i<n; i++)
        seqS[i] = Integer.parseInt(line[i]);

      int q = Integer.parseInt(br.readLine());
      line = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : line) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] == ref ) return true;
      else if( tar[mid] > ref ) right = mid;
      else left = mid + 1;
    }

    return false;
  }
}
