MOD = 10 ** 9 + 7 INF = 10 ** 10 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from collections import deque from heapq import heapify,heappush,heappop def main(): n = int(input()) a = list(map(int,input().split())) a = [a[0]] + a + [a[-1]] ans = (n + 1)//2 cnt1 = (n + 1)//2 cnt2 = n//2 for i in range(1,n + 1): if i%2 == 0: if a[i - 1] == a[i] == a[i + 1]: cnt2 += 1 else: if a[i - 1] == a[i] == a[i + 1]: cnt1 += 1 ans = max(ans,cnt1,cnt2) print(ans) if __name__ =='__main__': main()