//LETS START AGAIN
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define F first 
#define S second
#define int long long int
signed main() 
{ 
    fast;
    int n;
    cin>>n;
    string s;
    cin>>s;
    s = '@'+s;
    int b[n+1]={};
    int ans = 1e18;
    int aa = 0,bb = 0;
    for(int i=1;i<=n;i++)
    {
        if(s[i] == '#')
        {
            b[i] = b[i-1]+1;
            bb++;
        }
        else 
        {
            b[i] = b[i-1];
            aa++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        int wleft = i-b[i];
        int bleft = b[i];
        int wright = aa-wleft;
        int bright = bb - bleft;
        int cnt = bleft+wright;
        ans = min(ans,cnt);
    }
    cout<<ans;
} 

