with open('group2.in','r',encoding='utf-8') as f:
	lines=f.readlines()
s=0
print(lines)
a=lines[0]
if a[1]=='\n':
  b=a[0]
else:
  b=int(a[0])*10+int(a[1])
for i in range(int(b)):
  m=lines[i+1]
  q=lines[i]
  if m>q[0]:
    s+=1
print(s*2)
      
