#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans = 0, tmp, j, k, f;
  char S[3000000];
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> S[i];
  }
  while (1) {
    f = 0;
    for (int i = 2; i <= N; i++) {
      tmp = 0;
      if (S[i - 1] == '#' && S[i] == '.') {
        f = 1;
        j = i - 1;
        k = i;
        while (1) {
          tmp += 1;
          j -= 1;
          k += 1;
          if (S[j] == '.' || j == 0) {
            for (int x = j; x <= (i - 1); x++) {
              S[x] = '.';
            }
            break;
          } else if (S[k] == '#' || k == (N + 1)) {
            for (int x = i; x <= k; x++) {
              S[x] = '#';
            }
            break;
          }
        }
        i += tmp;
        ans += tmp;
      }
    }
    if (f == 0) {
      break;
    }
  }
  cout << ans;
  return 0;
}
