begin
var n := ReadInteger();
var a := ReadArrInteger(n);
var Count := 0;
foreach var x in a do
var s := x.ToString;
if s[1] = s[s.Length] then Count += 1
end;
Print(Count)
end.
begin
var n := ReadInteger();
var a := ReadArrInteger(n);
var Count := 0;
foreach var x in a do
begin
var s := x.ToString;
if s[1] = s[s.Length] then Count += 1
end;
Print(Count)
end.