Source Code
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
// please, read the question correctly (do you need set or multiset)???
const int N=200010; //check the limits, dummy
int a[N];
int n, m;
char s[N];
int main(){
// int t;cin>>t;while(t--){

	scanf("%d",&n);
	int ans  = 0;
	for(int i=0; i+1<n; ++i){
		scanf("%d",&a[i]);
	}
	for(int i=0; i+1<n; ++i){
		if(a[i]!=a[i+1]){
			++ans;
			++i;
		}
	}
	cout<<ans<<endl;

// }
return 0;
}
Copy
Tha Bits Zain
GNU G++17
0 ms
576 KB
Wrong Answer