Source Code
   #include<bits/stdc++.h>
    using namespace std;
#define  ll long long
#define Min_Element(a)    (*min_element((a).begin(), (a).end()))
#define Max_Element(a)    (*max_element((a).begin(), (a).end()))
    int main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
     int n;
     cin>>n;
     vector<int>v(n);
        for (int i = 0; i <n ; ++i) {
            cin>>v[i];
        }
        int count=0;
        for (int i = i; i <n ; ++i) {
            if (v[i] != v[i - 1]) {
                count++;
                i++;
            }
        }
        cout<<count;
    }
Copy
Tha Bits AhmedEzzat
GNU G++17
0 ms
724 KB
Wrong Answer