Source Code
/*
	Failure is not the reason for you to stop trying
	   it is actually a remainder that you should
			KEEP GOING
*/
#include<bits/stdc++.h>
#define ll long long
#define SaveTime ios_base::sync_with_stdio(false), cin.tie(0);
using namespace std;

int main()
{
   SaveTime
   int n; cin >> n;
   int num[n];
   for (int i = 0; i < n; i++) {
      cin >> num[i];
   }
   int nb = 0;
   for (int i = 0; i < n-1; i++) {
      if (num[i] != num[i+1]) {
         nb++;
         i++;
      }
   }
   cout << nb;
}
Copy
Tha Bits chaffar107
GNU G++17
9 ms
1.2 MB
Accepted