#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 10000000000000000
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

void solve()
{
    ll n;
    cin>>n;
    string str;
    cin>>str;
    ll ct=0,i=0;
    while(str[i]=='.'&&i<n)
    {
        ct++;
        i++;
    }

    ll w=0,b=0;
    fr(i,0,n)
    {
        if(str[i]=='.')
            w++;
        else
            b++;
    }
    w-=ct;
    i=n-1,ct=0;
    while(str[i]=='#'&&i>=0)
    {
        ct++;
        i--;
    }
    cout<<min(b,w)<<endl;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
