I.e. n[i] should be sum over all days d of tickets[d] where d is the i-th day from the end of the month that d occurs in.
I.e. n[i] should be sum over all days d of tickets[d] where d is the i-th day from the end of the month that d occurs in.