#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k;
  string s;
  cin >> n >> s;
  char ch = s[n - 1];
  long long c1 = 0, c2 = 0, ans = 0;
  vector<long long> v;
  long long c = 1;
  for (long long i = 1; i < n; ++i) {
    if (s[i] == s[i - 1])
      c++;
    else
      v.push_back(c), c = 1;
  }
  v.push_back(c);
  long long t = v.size();
  if (ch == '#') {
    for (long long i = 1; i < t - 1; ++i) {
      if (i % 2 == 0)
        c1 += v[i];
      else
        c2 += v[i];
    }
    if (s[0] == '#') c1 += v[0];
    if (c1 == 0)
      ans = c2;
    else if (c2 == 0)
      ans = c1;
    else
      ans = min(c1, c2);
    cout << ans;
  } else {
    for (long long i = 1; i < t; ++i) {
      if (i % 2 == 0)
        c1 += v[i];
      else
        c2 += v[i];
    }
    if (s[0] == '#') c1 += v[0];
    if (c1 == 0)
      ans = c2;
    else if (c2 == 0)
      ans = c1;
    else
      ans = min(c1, c2);
    cout << ans;
  }
  return 0;
}
