arr = [1,2,3,2,3,4,5,1] 

cnt = 1
maxCnt = 0

for i in range(1,len(arr)):
    if arr[i] == arr[i-1]+1:
        cnt+=1
    else:
        if maxCnt < cnt:
            maxCnt = cnt
        cnt = 1;

print(maxCnt)


    
    

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: