ну да
var n, k, i, j: integer;
s1: string;
begin
{assign(input, 'input.txt');
reset(input);
assign(output, 'OUTPUT.TXT');
rewrite(output);}
readln(n);
setlength(s1, 1000);
k := 0;
for i := 0 to n do
begin
readln(s1);
for j := 0 to 998 do
begin
if (s1[1] = 'A') and (s1[j + 1] = 'A') then
inc(k);
end;
end;
write(k);
end.