from math import *
file=open("e:\\words.txt")
def make(x):
sum=0
for i in range(len(x)):
sum+=(ord(x[i])-ord('A')+1)
return sum
s=file.read()
f=s.split(',')
tot=0
for i in range(len(f)):
x=f[i][1:len(f[i])-1]
num=make(x)
k=int(sqrt(2*num))
if k*(k+1)==2*num:
tot+=1
print(tot)
file.close()
file=open("e:\\words.txt")
def make(x):
sum=0
for i in range(len(x)):
sum+=(ord(x[i])-ord('A')+1)
return sum
s=file.read()
f=s.split(',')
tot=0
for i in range(len(f)):
x=f[i][1:len(f[i])-1]
num=make(x)
k=int(sqrt(2*num))
if k*(k+1)==2*num:
tot+=1
print(tot)
file.close()