Source Code
#include <iostream>
using namespace std;

int main() {
	int n, last=-1, res=0, x;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>x;
		if(last !=-1 && x!=last){
			++res;
			last = -1;
		}
		else last = x;
	}
	cout<<res<<endl;
	return 0;
}
Copy
Tha Bits AhmadEdais
GNU G++17
22 ms
380 KB
Accepted