#include <bits/stdc++.h>
using namespace std;
int devide(int N, string S) {
  if (N == 1) {
    return 0;
  } else if (N == 2) {
    if (S == "##" || S == "..") {
      return 0;
    } else {
      return 1;
    }
  } else if (N % 2 == 1) {
    int black_count = 0;
    int white_count = 0;
    for (int i = 0; i < ((N - 1) / 2); i++) {
      if (S[i] == '#') {
        black_count++;
      }
    }
    for (int i = 0; i < ((N - 1) / 2); i++) {
      if (S[S.size() - 1 - i] == '.') {
        white_count++;
      }
    }
    if (black_count < white_count) {
      return black_count + devide((N + 1) / 2, S.substr((N - 1) / 2));
    } else {
      return white_count + devide((N + 1) / 2, S.substr(0, (N + 1) / 2));
    }
  } else {
    int black_count = 0;
    int white_count = 0;
    for (int i = 0; i < (N / 2); i++) {
      if (S[i] == '#') {
        black_count++;
      }
    }
    for (int i = 0; i < (N / 2); i++) {
      if (S[S.size() - 1 - i] == '.') {
        white_count++;
      }
    }
    if (black_count < white_count) {
      return black_count + devide(N / 2, S.substr((N / 2)));
    } else {
      return white_count + devide(N / 2, S.substr(0, (N / 2)));
    }
  }
}
int main(int argc, char const *argv[]) {
  int N;
  string S;
  cin >> N;
  cin >> S;
  cout << devide(N, S);
  return 0;
}
