Unbirthdays#1475

Unbirthdays

1 second
64 megabytes
Very easy

At the Mad Hatter's table, daily mad tea parties are attended by a regular group of characters. The birth dates of each character are known. In Wonderland, instead of birthdays, unbirthday days are celebrated. An unbirthday for a character is a day such that neither the day of the month nor the month coincides with their 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 be held during a non-leap year.

Input

The first line contains an integer (1 \leq N \leq 1000) — the number of characters. Each of the following lines contains two integers and (1 \leq d \leq 31, 1 \leq m \leq 12), representing the day and month of birth for each character. It is guaranteed that all dates are valid: the day does not exceed the number of days in the corresponding month of a non-leap year.

Output

Output a single integer — the number of common unbirthday days for the group in a year.

Examples

Example 1

Loading
Loading