from datetime import date,timedelta
def cur(ds,today=None):
    today=today or date.today()
    if not ds: return 0
    s=set(ds); n=0; d=today
    while d in s:
        n+=1; d-=timedelta(days=1)
    return n
def longest(ds):
    if not ds: return 0
    ds=sorted(ds)
    b=c=1
    for i in range(1,len(ds)):
        if (ds[i]-ds[i-1]).days==1:
            c+=1; b=max(b,c)
        else: c=1
    return b
t=date(2026,10,17)
ds=[t-timedelta(days=i) for i in range(5)]
assert cur(ds,t)==5 and cur([],t)==0
assert longest(ds)==5
print("SELF-TEST PASS")