uses crt;
var s:string; n,g:longint; d:text;
begin
clrscr;
assign(d,'Dulieu.txt');reset(d);
while not(eof(d)) do
begin
readln(d,s);
s:=upcase(s);
if s='NAM' then inc(n) else if s='NU' then inc(g);
end;
close(d);
assign(d,'output.pas');rewrite(d);
writeln(d,'So hoc sinh nam: ',n);
writeln(d,'So hoc sinh nu: ',g);
close(d);
readln
end.