include iostream include cmath include conio using namespace std int 1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <cmath>
#include <conio.h>
using namespace std;
int a[1000000];
int main(){
int count = 1, n;
cout << "Vvedite razmer massiva" << endl;
cin >> n;
cout << "Vvedite elementi massiva" << endl;
for (int q=0; q<n; q++)
cin >> a[q];
for (int q=0; q<n-1; q++){
if (a[q+1] != a[q])
count++;
}
cout << count << endl;
}