# -*- coding: utf-8 -*- D = int(input()) C = input() C += input() #maru = batsu = 0 maru = 2 batsu = 0 weekday = True cont_list = [] for c in C: if weekday and c=='o': maru += 1 elif weekday and c=='x': cont_list.append(maru) batsu = 1 weekday = False elif not weekday and c=='x': batsu += 1 elif not weekday and c=='o': cont_list.append(batsu) maru = 1 weekday = True if weekday: cont_list.append(maru) else: cont_list.append(batsu) ans = 0 for i in range(1, len(cont_list), 2): holidays = cont_list[i] if D >= holidays: c_holidays = cont_list[i-1] + holidays if i+1