let is_palindrome s =
  let len = String.length s in
  let rec loop = function
      i when i = (len/2) -> true
    | i -> if s.[i] = s.[len-1-i] then
             loop (i+1)
           else false
  in loop 0;;

let () =
  let rec read count =
    try let line = read_line () in
        if is_palindrome line then
          read (count+1)
        else
          read count
    with End_of_file
         -> count
  in
  Printf.printf "%d\n" (read 0);;