#include using namespace std; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> n >> s; string t(n,'.'); s = t+s; for(int i=2*n-2;i>=0;i--){ if(s[i]=='#'){ s[i] = '.'; cnt++; } if(cnt && s[i+1]=='.'){ s[i] = '#'; cnt--; ans = 2*n-i; } } cout << ans << '\n'; return 0; }