#include <bits/stdc++.h>
using namespace std;
int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
vector<int> adj[300010];
vector<int> par(300010, -1);
vector<int> disco(300010, -1);
vector<int> finis(300010, -1);
vector<int> typ(300010, 0);
vector<int> vis(300010, 0);
vector<int> dis(300010, 0);
vector<int> val;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i = 0, cnt1 = 0, cnt2 = 0;
  while (i < s.length() && s[i] == '.') {
    i++;
  }
  while (s.back() == '#') {
    s.pop_back();
  }
  int ans = 0;
  int auxi = 0;
  while (i < s.length()) {
    cnt1 = 0;
    cnt2 = 0;
    auxi = i;
    while (i < s.length() && s[i] == '#') {
      cnt1++;
      i++;
    }
    while (i < s.length() && s[i] == '.') {
      cnt2++;
      i++;
    }
    if (min(cnt1, cnt2) == cnt2) {
      ans = ans + min(cnt1, cnt2);
    } else {
      break;
    }
  }
  cnt1 = 0;
  cnt2 = 0;
  int flag = 0;
  while (i < s.length()) {
    if (flag == 0) {
      i = auxi;
      flag = 1;
    }
    if (s[i] == '#') {
      cnt1++;
    } else {
      cnt2++;
    }
    i++;
  }
  cout << ans + min(cnt1, cnt2) << '\n';
}
