#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
using vpl = vector<pl>;
using vvpl = vector<vpl>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const ll dx[8] = {0, -1, 0, 1, 1, -1, 1, -1};
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
void rle(string s, vector<char>& cha, vector<ll>& num) {
  ll a = 0, cnt = 0;
  string t;
  char x = s[0];
  while (a < s.size()) {
    if (x == s[a])
      cnt++;
    else {
      cha.push_back(x);
      num.push_back(cnt);
      x = s[a];
      cnt = 1;
    }
    a++;
  }
  cha.push_back(x);
  num.push_back(cnt);
}
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  vl num;
  vector<char> c;
  rle(s, c, num);
  if (c[0] == '.') num[0] = 0;
  if (*c.rbegin() == '#') *num.rbegin() = 0;
  ll w = 0, b = 0;
  for (ll i = 0; i < c.size(); i++) {
    if (c[i] == '#')
      b += num[i];
    else
      w += num[i];
  }
  cout << min(w, b) << endl;
}
