eolymp
bolt
Try our new interface for solving problems
Problems

Superstitious Santa Claus

Superstitious Santa Claus

Time limit 1 second
Memory limit 64 MiB

How ‘s you know in different years interchange and different Santa Clauses transport the presents. But all of they are superstitious and transport presents all the year, except that days, when "Friday, 13" on the calendar of Santa Claus.

How many days Santa Claus wasn’t transport the presents during his duty?

Input data

In the first line, the number K is the Santa Claus’s quantity shifts of duty.

Next in K lines through the gaps you can see years A and B, which hit on shifts.

1920AB2050 (on the Gregorian calendar).

Output data

One number is the quantity days, when Santa Claus will not transport the presents.

Examples

Input example #1
2
1999 2000
1991 1997
Output example #1
13