import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().trim.toInt
  val lst1 = StdIn.readLine().trim.split(' ').map(_.toInt) ++ Array(-1)
  val t = StdIn.readLine().trim.toInt
  val lst2 = StdIn.readLine().trim.split(' ').map(_.toInt)
  
  val result = lst2.foldLeft(0){ (acc, e) =>
    lst1(n) = e
    var i = 0
    while(lst1(i)!=e)i+=1

    if(i == n) acc else acc + 1
  }
  
  println(result)

}

