#include using namespace std; const int INF = 1 << 30; int solve(string S, int N) { int right = -1, ret = 0; for(int i = N; i >= 0; i--) { if(S[i] == '#') right = i; } if(right == -1) return (INF); for(int i = N - 1; i > right; i--) { S[i] = ".#"[S[i] == '.']; ++ret; } S += "."; int rest = count(begin(S), end(S), '#'); while(rest > 0) { S[right] = ".#"[S[right] == '.']; if(S[right] == '.') rest--; else rest++; ++right; ++ret; if(S[right - 1] == '#') { S[right] = ".#"[S[right] == '.']; if(S[right] == '.') rest--; else rest++; ++ret; --right; } } return (ret); } int main() { int N; string S, T; cin >> N; cin >> S; T = S; reverse(begin(T), end(T)); cout << min(solve(S, N - 1), solve(T, (int) S.size() - N)) << endl; }