#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
pair<long long, long long> maxP(vector<long long> a, long long size) {
  pair<long long, long long> p;
  vector<long long>::iterator iter = max_element(a.begin(), a.end());
  p.first = *iter;
  p.second = distance(a.begin(), iter);
  return p;
}
pair<long long, long long> minP(vector<long long> a, long long size) {
  pair<long long, long long> p;
  vector<long long>::iterator iter = min_element(a.begin(), a.end());
  p.first = *iter;
  p.second = distance(a.begin(), iter);
  return p;
}
long long sumL(vector<long long> a, long long size) {
  long long sum = 0;
  for (int i = (0); i < (size); ++i) {
    sum += a[i];
  }
  return sum;
}
long long counT(vector<long long> a, long long t) {
  sort(a.begin(), a.end());
  return upper_bound(a.begin(), a.end(), t) -
         lower_bound(a.begin(), a.end(), t);
}
long long DIV[1000 + 1][1000 + 1];
void divide(long long n, long long m) {
  DIV[0][0] = 1;
  for (int i = (1); i < (n + 1); ++i) {
    DIV[i][0] = 0;
  }
  for (int i = (0); i < (n + 1); ++i) {
    DIV[i][1] = 1;
  }
  for (int i = (1); i < (m + 1); ++i) {
    for (int t = (0); t < (n + 1); ++t) {
      if (DIV[t][i] > 0) continue;
      if (t >= i) {
        DIV[t][i] = DIV[t - i][i] + DIV[t][i - 1];
      } else {
        DIV[t][i] = DIV[t][i - 1];
      }
    }
  }
}
long long search(vector<long long> &a, long long n) {
  std::vector<long long>::iterator iter = std::find(a.begin(), a.end(), n);
  size_t index = distance(a.begin(), iter);
  return index;
}
vector<bool> IS_PRIME_CONTAINER(1000005, true);
void IsPrime_Contain(long long num) {
  IS_PRIME_CONTAINER[0] = false;
  IS_PRIME_CONTAINER[1] = false;
  for (int i = (2); i < (sqrt(num)); ++i) {
    if (IS_PRIME_CONTAINER[i]) {
      for (int j = (2); j < (num / i + 1); ++j) {
        if (j * i <= num) {
          IS_PRIME_CONTAINER[i * j] = false;
        }
      }
    }
  }
}
bool IsPrime(long long num) { return IS_PRIME_CONTAINER[num]; }
class UnionFind {
 public:
  vector<long long> par;
  vector<long long> rank;
  UnionFind(long long N) : par(N), rank(N) {
    for (int i = (0); i < (N); ++i) par[i] = i;
    for (int i = (0); i < (N); ++i) rank[i] = 0;
  }
  ~UnionFind() {}
  long long root(long long x) {
    if (par[x] == x)
      return x;
    else {
      par[x] = root(par[x]);
      return par[x];
    }
  }
  void unite(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    if (rx == ry) return;
    if (rank[rx] < rank[ry]) {
      par[rx] = ry;
    } else {
      par[ry] = rx;
      if (rank[rx] == rank[ry]) {
        rank[rx]++;
      }
    }
  }
  bool same(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    return rx == ry;
  }
};
class BFS_shortestDistance {
 public:
  BFS_shortestDistance(vector<vector<char> > p_, long long h_, long long w_) {
    p = p_;
    h = h_;
    w = w_;
    initial_number = h * w * 2;
    for (int i = (0); i < (h); ++i) {
      vector<long long> k(w);
      for (int t = (0); t < (w); ++t) k[t] = initial_number;
      field.push_back(k);
    }
  }
  vector<vector<char> > p;
  long long h;
  long long w;
  long long initial_number;
  vector<vector<long long> > field;
  pair<long long, long long> plus(pair<long long, long long> &a,
                                  pair<long long, long long> &b) {
    pair<long long, long long> p;
    p.first = a.first + b.first;
    p.second = a.second + b.second;
    return p;
  }
  bool equal(pair<long long, long long> &a, pair<long long, long long> &b) {
    return (a.first == b.first && a.second == b.second);
  }
  bool is_in_field(int h, int w, const pair<long long, long long> &point) {
    const int c = point.second;
    const int r = point.first;
    return (0 <= c && c < w) && (0 <= r && r < h);
  }
  void init() {
    for (int i = (0); i < (field.size()); ++i) {
      for (int t = (0); t < (field[i].size()); ++t) {
        field[i][t] = initial_number;
      }
    }
  }
  void shortest(long long sy, long long sx) {
    init();
    pair<long long, long long> c[4];
    c[0].first = 0;
    c[0].second = 1;
    c[1].first = 0;
    c[1].second = -1;
    c[2].first = 1;
    c[2].second = 0;
    c[3].first = -1;
    c[3].second = 0;
    queue<pair<long long, long long> > Q;
    pair<long long, long long> s;
    s.first = sy;
    s.second = sx;
    field[sy][sx] = 0;
    Q.push(s);
    while (Q.empty() == false) {
      pair<long long, long long> now = Q.front();
      Q.pop();
      for (int u = 0; u < 4; u++) {
        pair<long long, long long> x = c[u];
        pair<long long, long long> next = plus(now, x);
        if (is_in_field(h, w, next)) {
          if (p[next.first][next.second] == '.') {
            if (field[next.first][next.second] == initial_number) {
              field[next.first][next.second] = field[now.first][now.second] + 1;
              Q.push(next);
            } else {
            }
          }
        }
      }
    }
  }
};
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> a(n);
  for (int i = (0); i < (n); ++i) {
    if (s[i] == '.')
      a[i] = 0;
    else
      a[i] = 1;
  }
  long long first = a[0];
  vector<vector<long long> > sum(2);
  if (first == 1) {
    sum[0].push_back(0);
  }
  sum[1].push_back(0);
  long long ss = 1;
  for (int i = (1); i < (n); ++i) {
    if (a[i] == a[i - 1]) {
      ss++;
    } else {
      sum[a[i - 1]].push_back(ss);
      ss = 1;
    }
    if (i == n - 1) {
      sum[a[i]].push_back(ss);
    }
  }
  for (int i = (0); i < (sum[0].size()); ++i) {
    if (i == 0) continue;
    if (i >= 1) sum[0][i] = sum[0][i] + sum[0][i - 1];
  }
  for (int i = (0); i < (sum[1].size()); ++i) {
    if (i == 0) continue;
    if (i >= 1) sum[1][i] = sum[1][i] + sum[1][i - 1];
  }
  long long maxi = 10000000;
  if (first == 0) {
    for (int i = (0); i < (sum[1].size()); ++i) {
      long long ssu = sum[1][i];
      ssu += sum[0][sum[0].size() - 1] - sum[0][i];
      maxi = min(maxi, ssu);
    }
  } else {
    for (int i = (0); i < (sum[1].size()); ++i) {
      long long ssu = sum[1][i];
      ssu += sum[0][sum[0].size() - 1] - sum[0][i];
      maxi = min(maxi, ssu);
    }
  }
  cout << maxi;
  return 0;
}
