#include using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) constexpr int mod=1000000007; constexpr int mod1=998244353; vector dx={0,1,0,-1},dy={-1,0,1,0}; bool inside(int y,int x,int h,int w){ if(y=0 && x=0) return true; return false; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin >> n; vector a(n); rep(i,n) cin >> a.at(i); int ans = 0; if(n % 2 == 0){ ans = n / 2; int cnt1 = 0, cnt2 = 0; for(int i = 2; i < n; i += 2){ if(a.at(i - 1) == a.at(i) && a.at(i) == a.at(i + 1)) cnt1++; } if(a.at(0) == a.at(1)) cnt1++; for(int i = 1; i < n - 1; i += 2){ if(a.at(i - 1) == a.at(i) && a.at(i) == a.at(i + 1)) cnt2++; } if(a.at(n - 1) == a.at(n - 2)) cnt2++; ans += max(cnt1, cnt2); } else{ ans = n / 2 + 1; for(int i = 1; i < n - 1; i += 2){ if(a.at(i - 1) == a.at(i) && a.at(i) == a.at(i + 1)) ans++; } } cout << ans << endl; }