#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  string S;
  cin >> S;
  long long ib = S.find('#');
  long long ie = S.rfind('.');
  if (ib == string::npos || ie == string::npos)
    cout << 0 << endl;
  else {
    long long nB = count(S.begin() + ib, S.begin() + ie, '#');
    long long nW = ie + 1 - nB - ib;
    cout << min(nB, nW) << endl;
  }
  return 0;
}
