#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  while (scanf("%d", &a) != EOF) {
    string temp;
    cin >> temp;
    int arr[a];
    if (temp[0] == '#')
      arr[0] = 1;
    else
      arr[0] = 0;
    for (int i = 1; i < a; i++) {
      if (arr[i] == '#')
        arr[i] = arr[i - 1] + 1;
      else
        arr[i] = arr[i - 1];
    }
    int count = 0;
    int start = 0;
    for (int i = a - 1; i >= 0; i--) {
      if (temp[i] != '#') start = 1;
      if (start && temp[i] == '.') {
        int hehe = 1;
        for (int j = i - 1; j >= 0; j--) {
          if (temp[j] != '.') break;
          hehe++;
        }
        if (hehe > arr[i]) {
          count += arr[i];
          break;
        } else {
          count += hehe;
          i -= hehe;
          i++;
        }
      }
    }
    printf("%d\n", count);
  }
  return 0;
}
