''' Created on 2015/06/06 ''' D = int(input()) date = "xxxxxxxxxxxxxx" + input() + input() + "xxxxxxxxxxxxxx" def calc(day): ans, tmp = 0, 0 for d in day: if d == 'o': tmp += 1 else: ans = max(ans, tmp) tmp = 0 return max(ans, tmp) ans = calc(date) for i in range(len(date)): d = date for x in range(i, len(date)): if x-i == D: break if date[x] == 'x': d = d[:x] + "o" + d[x+1:] else: break ans = max(ans, calc(d)) print(ans)