import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val s = sc.next()
  val t = sc.next()


  val prefixArray = Array(n) { s.substring(it) }
  val suffixArray = Array(n) { t.substring(0, it+1) }

  var max = 0
  for (pi in prefixArray) {
    for (si in suffixArray) {
      if (pi == si) {
        max = Math.max(pi.length, max)
      }
    }
  }

  println(n * 2 - max)

}
