local mmi, mma = math.min, math.max local n = io.read("*n", "*l") local s = io.read() local t = {} for i = 1, n do if s:sub(i, i) == "#" then table.insert(t, i) end end local ret = -1 local block = 1 for i = #t, 1, -1 do ret = mma(n + 1 - t[i], ret + 2) -- print(ret) end print(ret)