#include <bits/stdc++.h>
long long INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1) {
  unsigned day;
  if (dow < dow1) dow += 7;
  day = dow - dow1;
  day += 7 * n - 6;
  return day;
}
signed gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
signed lcm(long long x, long long y) { return x / gcd(x, y) * y; }
unsigned DayToWeekNumber(unsigned day) { return (day - 1) / 7 + 1; }
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0) {
  return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
  long long N;
  cin >> N;
  string S;
  cin >> S;
  bool b = false;
  long long ans = 0;
  long long count = 0;
  for (long long i = 0; i < (long long)(S.size() - 1); i++) {
    if (S.at(i) == '#' && S.at(i + 1) == '.') {
      long long ans0 = 0;
      for (long long j = i + 1; j < S.size() - i + 1; j++) {
        if (S.at(j) == '.') {
          ans0++;
          continue;
        }
        break;
      }
      if (count + 1 < ans0) {
        S.at(i) = '.';
        ans += count + 1;
        count = 0;
        b = false;
        continue;
      } else if (b == false)
        S.at(i) = '.';
      else
        S.at(i + 1) = '#';
      ans++;
      ans0 = 0;
    }
    if (S.at(i) == '#') {
      b = true;
      count++;
    }
  }
  cout << ans << endl;
}
