#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll ans=0;
    ll cnt1=0;
    ll cnt2=0;
    vector<P> cnt;
    rep(i,n-1){
      if(i<=n-2 && s[i]=='#' && s[i+1]=='.'){
        ll j=i,k=i;
        cnt1++;
        cnt2++;
        while(j-1>=0 && s[j-1]=='#'){
          cnt1++;
          j--;
        }
        while(k+2<=n-1 && s[k+2]=='.'){
          cnt2++;
          k++;
        }
        //cout<<i<<' '<<cnt1<<' '<<cnt2<<'\n';
        cnt.push_back({cnt1,cnt2});
        //ans+=min(cnt1,cnt2);
        i+=min(cnt1,cnt2);
        cnt1=0,cnt2=0;
        /*
        if(cnt1>cnt2 && i+1<=n-1 && s[i+1]=='#'){
          cnt1=cnt2+cnt1;
        }else{
          cnt1=0;
        }
        cnt2=0;
        */
      }
      //cout<<i<<'\n';
    }
    rep(i,len(cnt)){
      //cout<<cnt[i].first<<' '<<cnt[i].second<<'\n';
      if(cnt[i].first<=cnt[i].second){
        ans+=cnt[i].first;
      }else{
        if(i!=len(cnt)-1){
          if(cnt[i].first<cnt[i+1].second && cnt[i].first+cnt[i+1].first>=cnt[i+1].second){
            ans+=cnt[i].first;
          }else{
            ans+=cnt[i].second;
          }
        }else{
        ans+=cnt[i].second;
      }
    }
    cout<<ans<<endl;
}
