#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline bool minimize(T1& a, T2 b) {
  return b < a && (a = b, 1);
}
template <class T1, class T2>
inline bool maximize(T1& a, T2 b) {
  return a < b && (a = b, 1);
}
template <class T, class V>
istream& operator>>(istream& ist, pair<T, V>& p) {
  return ist >> p.first >> p.second;
}
template <class T>
ostream& operator<<(ostream& ost, pair<T, T>& p) {
  return ost << p.first << ", " << p.second;
}
template <class T>
istream& operator>>(istream& ist, vector<T>& vs) {
  for (auto& e : vs) ist >> e;
  return ist;
}
int const inf = INT_MAX / 2;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  char now = '.';
  int x = 0, y = 0, ans = 0;
  for (int i = 0; i < (int)N; i++) {
    if (now == '.' && S[i] == '#') {
      ans += min(x, y);
      x = 1, y = 0;
    }
    if (now == '#' && S[i] == '#') {
      x++;
    }
    if (now == '#' && S[i] == '.') {
      y = 1;
    }
    if (now == '.' && S[i] == '.') {
      y++;
    }
    now = S[i];
  }
  ans += min(x, y);
  cout << ans << endl;
}
