d = int(input()) r = a = e = d b = 0 for c in input() + input(): if c == 'o': if e > 0: b = a a = e = 0 a += 1 r = max(r, a+b) else: if e < d: a += 1 e += 1 r = max(r, a) else: a = d print(a, b, e) r = max(r, a+d-e) print(r)