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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    return false;
  }
}

class StrSplitToInt {
  String s;
  String split;
  int currentPos;
  int nextPos;
  int endPos;

  public StrSplitToInt(String s,String split) {
    this.s = s;
    this.split = split;
    currentPos = 0;
    nextPos = s.indexOf(split, currentPos);
    endPos = s.length();
  }

  public int nextInt() {
    if( currentPos < endPos ) {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    }
    else
      return -1;
  }
} 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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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(); line br.readLine() br.readLine br StrSplitToInt stoi = new StrSplitToInt(line, " "); stoi new StrSplitToInt(line, " ") for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i seqS[i] = stoi.nextInt(); seqS[i] = stoi.nextInt() seqS[i] seqS i stoi.nextInt() stoi.nextInt stoi int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] lines = br.readLine().split(" "); lines br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int cnt=0; cnt 0 for (String ref : lines) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      } String ref lines {
        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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

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

    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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    } left < right left right {
      mid  = (left + right) / 2;
      if( tar[mid] > ref ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    } mid  = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if( tar[mid] > ref ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true; tar[mid] > ref tar[mid] tar mid ref right = mid right mid if(tar[mid] < ref ) left = mid + 1;
      else return true; tar[mid] < ref tar[mid] tar mid ref left = mid + 1 left mid + 1 mid 1 return true; true return false; false int[] tar tar int ref ref class StrSplitToInt {
  String s;
  String split;
  int currentPos;
  int nextPos;
  int endPos;

  public StrSplitToInt(String s,String split) {
    this.s = s;
    this.split = split;
    currentPos = 0;
    nextPos = s.indexOf(split, currentPos);
    endPos = s.length();
  }

  public int nextInt() {
    if( currentPos < endPos ) {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    }
    else
      return -1;
  }
} StrSplitToInt String s; s String split; split int currentPos; currentPos int nextPos; nextPos int endPos; endPos public StrSplitToInt(String s,String split) {
    this.s = s;
    this.split = split;
    currentPos = 0;
    nextPos = s.indexOf(split, currentPos);
    endPos = s.length();
  } StrSplitToInt {
    this.s = s;
    this.split = split;
    currentPos = 0;
    nextPos = s.indexOf(split, currentPos);
    endPos = s.length();
  } this.s = s this.s this this.s s this.split = split this.split this this.split split currentPos = 0 currentPos 0 nextPos = s.indexOf(split, currentPos) nextPos s.indexOf(split, currentPos) s.indexOf s split currentPos endPos = s.length() endPos s.length() s.length s String s s String split split public int nextInt() {
    if( currentPos < endPos ) {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    }
    else
      return -1;
  } nextInt {
    if( currentPos < endPos ) {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    }
    else
      return -1;
  } if( currentPos < endPos ) {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    }
    else
      return -1; currentPos < endPos currentPos endPos {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    } String i = s.substring(currentPos, nextPos); i s.substring(currentPos, nextPos) s.substring s currentPos nextPos currentPos = nextPos + split.length() currentPos nextPos + split.length() nextPos split.length() split.length split nextPos = s.indexOf(split, currentPos) nextPos s.indexOf(split, currentPos) s.indexOf s split currentPos if(nextPos == -1) nextPos = endPos; nextPos == -1 nextPos -1 1 nextPos = endPos nextPos endPos return Integer.parseInt(i); Integer.parseInt(i) Integer.parseInt Integer i return -1; -1 1 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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    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();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        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 ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    return false;
  }
}

class StrSplitToInt {
  String s;
  String split;
  int currentPos;
  int nextPos;
  int endPos;

  public StrSplitToInt(String s,String split) {
    this.s = s;
    this.split = split;
    currentPos = 0;
    nextPos = s.indexOf(split, currentPos);
    endPos = s.length();
  }

  public int nextInt() {
    if( currentPos < endPos ) {
      String i = s.substring(currentPos, nextPos);
      currentPos = nextPos + split.length();
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return Integer.parseInt(i);
    }
    else
      return -1;
  }
}
