n = int(input())
cnt = 0

for _ in range(n):
    chk = set()
    s = input()
    prev = None
    flag = True

    for ch in s:
        if ch != prev :
            if ch in chk:
                flag = False
                break
            if prev is not None:
                chk.add(prev)
            prev = ch
    
    if flag : cnt+=1

print(cnt)
