Davy Jones: You've been captain of the Black Pearl for 13 years. That was our agreement.
Jack: Technically I was only captain for two years, then I was mutinied upon.
Davy Jones: Then you were a poor captain, but a captain nonetheless. Have you not introduced yourself as Captain Jack Sparrow?
According to the Pirate Code, each of the pirates of the Caribbean at the beginning
of their professional career (hereditary pirates –– at birth) is assigned by
a unique identifier. Pirate's identifier is a string of four hexadecimal digits.
However, it is not a usual row of numbers, it is said that personal
qualities and life path of its owner are encoded in it by a mysterious way. But no one
still could guess this mystical connection.
Once Captain Jack Sparrow, while sitting in captain’s cabin, decided to try to find
the way to derive some data about a pirate using the identifier.
Memories about how he lost the Black Pearl last time gave him the idea
that more similar identifiers of two pirates are, bigger chances
for these pirates to unite against the Captain, and, as a result, to make a mutiny.
The Captain Jack Sparrow, of course, doesn’t want to have the mutiny on his ship,
but he chose the new team this time and it is going to be a long voyage.
Now Jack needs to estimate the opportunities of raising
the mutiny on his ship, based on the conclusions. For this aim he first wants to know
for each pair of pirates a number of positions in their identifiers in which they are different.
Input
The first line contains an integer n –– the number of pirates aboard the Black Pearl
(2 ≤ n ≤ 65536). Each of the following n lines contains fourdigit identifier
of the respective pirate. Only decimal digits and lowercase Latin letters from “a” to “f”
inclusive are used in writing identifiers. Identifiers of all pirates are different.
Output
Output four space separated integers –– the amount of pairs of pirates,
which have different identifiers exactly in one, two, three and four positions respectively.
Sample
input  output 

3
dead
beef
f00d
 0 0 2 1

Problem Author: Victor Vinogradov (prepared by Egor Shchelkonogov)
Problem Source: Open Ural FU Championship 2012