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

cnt=0
l = []
b = 1 if S[0] == "." else 0

for i in range(1, N):
    if S[i]==S[i-1]:
        cnt += 1
        if i == N-1:
            l.append(cnt+1)
    else:
        l.append(cnt+1)
        if i == N-1:
            l.append(1)
        cnt = 0

if len(l)<=1:
    print("0")
    exit()

s = 0
m = 1000000000
for i in range(b, len(l), 2):
    for j in range(b, i, 2):
        print(i, j, l[j])
        s += l[j]
    for j in range(i+1, len(l), 2):
        print(i, j, l[j])
        s += l[j]
    m = min(s, m)

print(l)
print(m)