human
Length of longest subsequence consisting of distinct adjacent elements | Function that finds the length of longest subsequence having different adjacent elements.
Stores the length of the longest subsequence.
Traverse the array.
If previous and current element are not same.
Increment the count.
Print the maximum length.
Driver Code.
Size of Array.
Function Call"
Solution in Python:

=====
Give me a code to length of longest subsequence consisting of distinct adjacent elements and the other steps required?
assistant
#Here is code to length of longest subsequence consisting of distinct adjacent elements and the other steps required.
 def longestSubsequence ( arr , N ) :
	count = 1
	for i in range ( 1 , N , 1 ) :
		if ( arr [ i ] != arr [ i - 1 ] ) :
			count += 1
	print ( count )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 7 , 8 , 1 , 2 , 2 , 5 , 5 , 1 ]
	N = len ( arr )
	longestSubsequence ( arr , N )