#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; string S; cin >> N >> S; int L = 0; while(S[L] != '#') L++; vector> v; v.push_back({S[0], 1}); for(int i = 1; i < N; i++) { if(v.back().first == S[i]) { v.back().second++; } else { v.push_back({S[i], 1}); } } ll ans = 0; for(auto [ch, cnt] : v) if(ch == '#') ans = max(ans, cnt); cout << ans + N - L - 1 << endl; }