import sys

N = int(input())
S = list(input())

zeros = ["." for i in range(N)]
ones = ["#" for i in range(N)]
lastone = ["." for i in range(N - 1)]
lastone.append("#")
firstzero = ["#" for i in range(N - 1)]
firstzero.insert(0, ".")
count = 0
z = 0
o = 0
l = 0
f = 0

for i in range(N - 1):
    if S[i] != S[i + 1]:
        count += 1

if (count == 0 or (S[0] == "." and count == 1)):
    print(0)
    sys.exit()        

for i in range(N):
    if S[i] != zeros[i]:
        z += 1

for i in range(N):
    if S[i] != ones[i]:
        o += 1

for i in range(N):
    if S[i] != lastone[i]:
        l += 1

for i in range(N):
    if S[i] != firstzero[i]:
        f += 1

print(min([z, o, l, f]))
