#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string s;
  cin >> s;
  int rui[1000010];
  int ans = 0;
  rui[0] = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == '#') {
      rui[i + 1] += rui[i] + 1;
    } else {
      rui[i + 1] = rui[i];
    }
  }
  for (int i = 0; i < N + 1; i++) {
    if (rui[i] == rui[i + 1] && rui[i] != 0) {
      int count = 0;
      for (count = 2;; count++) {
        if (rui[i] == rui[i + count]) continue;
        break;
      }
      if (count == 2) {
        s[i + 1] = '#';
        ans++;
      }
      if (count > 2) {
        s[i] = '.';
        ans++;
      }
      i += count - 1;
    }
  }
  cout << (ans) << endl;
}
