#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  char S[200000 + 1];
  cin >> S;
  int ans = 0;
  int i = 0, k = -1, j = 0, h = 0;
  while (i < N) {
    if (S[i] == '#') {
      if (k == -1) {
        k = i;
        j++;
      } else {
        if (h > 0) {
          if (h < j) {
            ans += h;
            k = -1;
            j = 0;
            h = 0;
          } else {
            ans += j;
            k = -1;
            j = 0;
            h = 0;
          }
        } else {
          j++;
        }
      }
    } else {
      if (k != -1) {
        if (j > 0) {
          if (j == 1) {
            ans++;
            k = -1;
            j = 0;
          } else {
            if (i == N - 1) {
              h++;
              if (h < j) {
                ans += h;
                k = -1;
                j = 0;
                h = 0;
              } else {
                ans += j;
                k = -1;
                j = 0;
                h = 0;
              }
            } else {
              h++;
            }
          }
        }
      }
    }
    i++;
  }
  cout << ans << endl;
}
