#include <bits/stdc++.h>
using namespace std;
template <typename T = long long>
inline T IN() {
  T x;
  cin >> x;
  return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&...tail) {
  cin >> head;
  CIN(move(tail)...);
}
const int INF = 1e9;
const int MOD = 998244353;
const long long LINF = 1e18;
long long N;
string S;
char pre, now;
long long white, black;
long long wsum, bsum;
int main() {
  cin >> N >> S;
  bool bex = false;
  for (int i = 0; i < (N); ++i) {
    now = S[i];
    if (now == '#' && pre == '#') {
      bsum++;
    } else if (now == '.' && pre == '.') {
      wsum++;
    } else if (now == '#' && pre == '.' && bex) {
      white += wsum + 1;
      wsum = 0;
    } else if (now == '.' && pre == '#') {
      black += bsum + 1;
      bsum = 0;
    }
    if (i == N - 1 && now == '.' && bex) {
      white += wsum + 1;
    }
    if (now == '#' && !bex) {
      bex = true;
      wsum = 0;
    }
    pre = S[i];
  }
  cout << min(white, black) << "\n";
}
