#include <bits/stdc++.h>
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}
template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}
template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}
void debug_out() { std::cerr << '\n'; }
template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  int idx = 0;
  while (idx < N - 1) {
    if (S[idx] == '#' && S[idx + 1] == '.') {
      int white_cnt = 0;
      while (1) {
        if (white_cnt > N - idx - 1) break;
        if (S[idx + 1 + white_cnt] == '.') {
          white_cnt++;
        } else
          break;
      }
      int black_cnt = 0;
      while (1) {
        if (black_cnt > idx) break;
        if (S[idx - black_cnt] == '#') {
          black_cnt++;
        } else
          break;
        ;
      }
      if (white_cnt > black_cnt) {
        idx++;
        ans += black_cnt;
      } else {
        ans += white_cnt;
        idx += white_cnt;
      };
    };
    idx++;
  }
  cout << ans << endl;
  return 0;
}
