import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val s = sc.next
  val t = sc.next

  val duplicate = n - (0 to n).find { i => t.startsWith(s.substring(i))}.get
  val res = n + n - duplicate

  println(res)
}