#K63317. Counting Sundays

    ID: 31727 Type: Default 1000ms 256MiB

Counting Sundays

Counting Sundays

You are given a list of dates in the format YYYY-MM-DD. Your task is to count how many of these dates fall on a Sunday.

To solve this problem, you need to parse each date and determine the day of the week it corresponds to. You can use built-in date libraries or implement Zeller's Congruence to compute the day of the week. In latex, one possible formula for Zeller's Congruence is given by:

\( h = \left(d + \left\lfloor \frac{13(m+1)}{5} \right\rfloor + K + \left\lfloor \frac{K}{4} \right\rfloor + \left\lfloor \frac{J}{4} \right\rfloor + 5J \right) \mod 7 \)

where if \( m < 3 \), then set \( m = m+12 \) and \( y = y-1 \), with \( d \) as the day, \( m \) as the month, \( y \) as the year, \( K = y \mod 100 \), and \( J = \lfloor y/100 \rfloor \). According to this formula, when \( h = 1 \) the day is Sunday.

Your program should read input from the standard input (stdin) and output the result to the standard output (stdout).

inputFormat

The first line of input contains a single integer \( n \) which denotes the number of dates. The following \( n \) lines each contain a date in the format YYYY-MM-DD.

outputFormat

Output a single integer representing how many of the given dates fall on a Sunday.

## sample
4
2023-08-14
2023-09-18
2025-12-26
2026-01-05
0