Unbirthdays
At the Mad Hatter's table, daily mad tea parties are attended by a regular group of N characters. The birth dates of each character are known. In Wonderland, they celebrate unbirthdays instead of birthdays. An unbirthday is a day when neither the day of the month nor the month itself matches the character's birthday. A festive tea party is held on any day when everyone at the table is celebrating their unbirthday.
Write a program to determine how many festive tea parties will occur during a non-leap year.
Input
The first line contains an integer N (1 ≤ N ≤ 1000) - the number of characters. Each of the following N lines contains a pair of integers d and m (1 ≤ d ≤ 31, 1 ≤ m ≤ 12), representing the day and month of birth for each character. It is guaranteed that all dates are valid, meaning the day does not exceed the number of days in the respective month of a non-leap year.
Output
Output a single line with the number of common unbirthday days for the group in a year.