#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 100000000;
const long long LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n;
  cin >> s;
  int ans = 0;
  int count1 = 0, count2 = 0;
  for (int i = 0; i < n; ++i) {
    if (i == n - 1 && s[i] == '#') continue;
    if (i == n - 1 && s[i] == '.') {
      count2++;
      ans += min(count2, count1);
    }
    if (s[i] == '#')
      count1++;
    else if (s[i] == '.' && s[i + 1] == '.') {
      count2++;
    } else if (s[i] == '.' && s[i + 1] == '#') {
      count2++;
      ans += min(count2, count1);
      count1 = 0;
      count2 = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
