Time

10:49:31
11 Feb 2012
ACM-ICPC Thailand Southern Region Programming Contest 2011
Left: 4 hours 11 minutes
End: 11.02.2012 15:00
Leader: Informatimukas
Five for week 22
Left: 11 hours 11 minutes
End: 11.02.2012 22:00
Leader: NuM
Version for print

Superstitious Santa Claus

prb31   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?


Specifications

   Input

   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

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


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 15% 122/144

Example

Example input

2
1999 2000
1991 1997

Example output

13


← Certification Problems Queen and pawn →