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())) + [-1] ans = (n + 1)//2 cnt = 0 i = 0 while i < n + 1: if a[i] == a[i + 1]: i += 1 cnt += 1 else: i += 2 cnt += 1 ans = max(ans,cnt) print(ans) if __name__ =='__main__': main()