fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    val t = readLine()!!

    (0..n).toList().last { s.takeLast(it)==t.take(it) }
        .let { println(2*n-it) }
}