/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/* libnum {{{*/
void amax(N, Args...)(ref N x, Args y) {
  x = x.max(y);
}
void amin(N, Args...)(ref N x, Args y) {
  x = x.min(y);
}
auto maxE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amax(y);
  return x;
}
auto minE(R)(R r) if (isInputRange!R) {
  ElementType!R x = r.front;
  r.popFront();
  foreach (y; r) x.amin(y);
  return x;
}
/*}}}*/

/+---test
3
#.#
---+/
/+---test
5
#.##.
---+/
/+---test
9
.........
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;
  const S = readln.chomp;

  const l = S.countUntil!(x => x != '.');
  const r = S.retro.countUntil!(x => x != '#');

  if (l < 0 || r < 0) {
    0.writeln;
    return;
  }

  auto dp1 = new long[](N);
  foreach_reverse (i; l..N) {
    if (i+1 < N) dp1[i] = dp1[i+1];
    if (S[i] == '.') ++dp1[i];
  }
  auto dp2 = new long[](N);
  foreach (i; 0..N-r) {
    if (i) dp2[i] = dp2[i-1];
    if (S[i] == '#') ++dp2[i];
  }

  dp1[0..l]   = dp1[l];
  dp2[$-r..$] = dp2[$-r-1];
  dp1 ~= 0;
  dp2  = 0 ~ dp2;

  zip(dp1, dp2).map!(x => x[0] + x[1]).minE.writeln;
}
