#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 2e5 + 5, M = 313, bghs = 1e9 + 7, inf = 1e18;
set<pair<long long int, long long int> > nt;
long long int r[maxn], l[maxn], sz[maxn], ss[maxn], a[maxn], n;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long int id = 0, td = 1;
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  a[n] = -1;
  for (long long int i = 1; i <= n; i++) {
    if (a[i - 1] != a[i]) {
      sz[id] = td;
      ss[id] = a[i - 1];
      r[id] = id + 1;
      l[id + 1] = id;
      sz[id] = td;
      nt.insert(make_pair(-sz[id], id));
      id++;
      td = 1;
    } else
      td++;
  }
  l[0] = r[id - 1] = id;
  l[id] = id - 1;
  r[id] = 0;
  ss[id] = -1;
  long long int ans = 0;
  while (nt.size() > 1) {
    ans++;
    auto p = *nt.begin();
    nt.erase(nt.begin());
    long long int i = p.second;
    if (ss[l[i]] != ss[r[i]]) {
      l[r[i]] = l[i];
      r[l[i]] = r[i];
      continue;
    }
    nt.erase(make_pair(-sz[l[i]], l[i]));
    nt.erase(make_pair(-sz[r[i]], r[i]));
    sz[l[i]] += sz[r[i]];
    r[l[i]] = r[r[i]];
    l[r[r[i]]] = l[i];
    nt.insert(make_pair(-sz[l[i]], l[i]));
  }
  cout << ans + 1 << endl;
}
