Jasio

No attempts yetTime limit1sMemory limit128 MB

Problem

Jasio has a list of words. He wants to count how many of them contain a palindrome of length at least two as a substring.

A palindrome reads the same forwards and backwards. For example, ala is a palindrome, but kot is not, because reversed it reads tok. The word foo contains the palindrome oo (length at least two), while the word ftof contains no palindrome of length at least two.

There is a catch. Jasio cannot read well yet: he cannot tell the letter i from j, and he cannot tell the letters p, b, and d apart. So when he reads a word he treats i and j as the same letter, and treats p, b, and d as the same letter. Because of this, Jasio also considers the word pod to contain a palindrome: to him p and d look the same, so pod reads the same both ways.

Write a program that:

  • reads the list of words to process,
  • counts the words that, read literally, contain a palindrome of length at least two,
  • counts the words that Jasio would consider to contain a palindrome of length at least two, treating i and j as one letter and p, b, d as one letter,
  • prints both counts.

Input

The first line contains the number of words nn (1n100001 \le n \le 10000). Each of the next nn lines contains exactly one word. Words consist only of lowercase English letters, and no word is longer than 200 characters.

Output

Print exactly two lines, each containing a single integer. The first line is the number of words that contain a palindrome of length at least two. The second line is that same count under Jasio's rule (i = j, p = b = d).