The Philippines is no stranger to natural disasters. We may not get too many tornados or forest fires here but we get more than our fair share of earthquakes, typhoons and floods. Hence, many Filipinos are used to the idea of emergency evacuation and evacuation centers, and in times of calamity, the separation of families is a common event. Due to the sheer volume of evacuees and the chaotic nature of disasters, it is not uncommon for a family to get evacuated to different centers, sometimes even in the same center they can get separated. In times like these, one needs their family more than anything. This is why the “In Case of Emergency” entry in ID cards is important, it can be used to locate your family. Usually, children list their parents, spouses list each other, elderly people list their children and even friends sometimes list each other, in other words, these link family members together. In times of emergency, these are the people they want to be with. This is how families are defined and in emergency situations it is very important to the relief efforts since the amount of resources needed to run an evacuation center is counted in terms of the number of families it contains. Obviously, it takes time to count how many families there are in terms of their emergency contact information, so a computer program that would do it automatically and quickly is of great benefit to disaster response and relief operations, and also to ease the anxiety of people fearing for their missing loved ones.
Input
The input consists of lines of emergency contact persons of persons in an evacuation center. Each line consists of two names separated by a ‘-‘. This means that the person on the left has listed the person on the right as their emergency contact person. You may assume that each name is unique to one person. A person with no emergency contact has themselves as their emergency contact.
Output
The output is a single integer that is the number of families in the evacuation center.
Sample Input
Jack - Monty
Lulu - Monty
Beth - Lulu
Edric - Chandra
Chandra - Nissa
Drake - Drake
Sample Output
3