#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T CHMAX(T& x, const T y) {
  return x = (x < y) ? y : x;
}
template <class T>
inline T CHMIN(T& x, const T y) {
  return x = (x > y) ? y : x;
}
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using V = vector<T>;
template <class T>
using V2 = vector<vector<T>>;
template <class T, int W = 255>
using A = array<T, W>;
template <class T, int W = 255, int H = 255>
using A2 = array<array<T, W>, W>;
int N;
std::string s;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  ;
  cin >> N;
  cin >> s;
  int ans = 0;
  int m1 = 0;
  int m2 = 0;
  for (int i = 1; i < static_cast<int>(N); i++) {
    if (s[i - 1] == '#') m1++;
    if (s[i - 1] == '#' && s[i] == '.') {
      while (i < N && s[i] == '.') {
        m2++;
        i++;
      }
      if (m1 <= m2) {
        ans += m1;
        m1 = 0;
        m2 = 0;
      } else {
        ans += m2;
        m1 += m2;
        m2 = 0;
      }
    }
  }
  cout << ans << "\n";
}
