def first(a): cnt=0 if a[0]==1: a[0]=0 else: a[0]=1 for i in range(1, len(a)): if a[i] != a[i - 1]: continue else: if a[i - 1] == T