Check if the difference of all adjacent elements is same
if ( A [ k + 1 ] - A [ k ] == comm_diff ) : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT flag = False NEW_LINE break NEW_LINE DEDENT if ( flag ) : NEW_LINE count += 1 NEW_LINE return count NEW_LINE