n=int(input()) a=list(map(int,input().split())) dp=[0]*(n+1) dp[1]=1 for i in range(1,n): if a[i]==a[i-1]: dp[i+1]=dp[i]+1 else: dp[i+1]=max(dp[i],dp[i-1]+1) print(dp[-1])