n=int(input()) a=list(map(int,input().split())) res=0 for x in a: if x%10-x//1000-x//100%10-x//10%10>0: res+=1 print(res)