#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; int main() { int d; cin >> d; string date = ""; rep(i, 0, 2) { string s; cin >> s; date += s; } int ans = -101010; rep(i, 0, 14) { string temp = date; int cnt = 0; rep(j, i, 14) { if (cnt == d)break; cnt++; temp[j] = 'o'; } int seq = 0; rep(k, 0, 14) { if (temp[k] == 'o')seq++; else seq = 0; ans = max(seq, ans); } } cout << ans << endl; return 0; }