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

    var dup = 0
    for (i in 1..n) {
        if (s.takeLast(i) == t.take(i)) {
            dup = Math.max(i, dup)
        }
    }
    println(n * 2 - dup)
}


