Program
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
// Begin here
return 0;
}n=int(input())
group_no = 0
groups = []
for x in range(n):
c = int(input())
if len(groups) == 0:
group_no+=1
elif groups[-1] != c:
group_no+=1
groups.append(c)
print(group_no)Comments
solution.cpp
- Begin here