n=int(input()) o,w=0,0 for i in range(n): t1=input() for t2 in t1: if t2=='o': o += 1 elif t2=='w': w += 1 if o>w: print(w) else: print(max(0,w-1))