D = int(input()) C = list(input()) C += list(input()) C = ["x"]*D + C +["x"]*D ans = 0 for i in range(14+D+1): if C[i]=="x": A = C[:] cnt = 0 while cnt