-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMahnets.cpp
53 lines (44 loc) · 1.29 KB
/
Mahnets.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
using namespace std;
#define R(f) freopen( (f), "r", stdin )
#define W(f) freopen( (f), "w", stdout )
#define pf printf
#define sf scanf
#define pfi(x) printf("%d\n",x)
#define pfs() printf(" ")
#define pfl() println("\n")
#define sfd(x) scanf("%lf",&x)
#define sfi(x) scanf("%d\n",&x)
#define take_LL(_x) scanf(LLId, &_x)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define FORE(i,a,n) for(int i=a; i<=n; i++)
#define REV(i,n,a) for(int i=n; i>=a; i--)
#define pb push_back
#define mset(x,n) memset(x,n,sizeof(x))
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> V;
typedef pair<int,int> PII;
typedef vector< PII > VII;
const int SZ = 1e5+10;
const double PI = 2*acos(0.0);
const double EPS = 1e-9;
int main(){
//R("input.txt");
//W("output.txt");
int arr[SZ];
int n,cnt=1,t;
sfi(n);
//cout << n << endl;
for(int j=0;j<n;j++){
cin >> arr[j];
}
for(int i=1;i<n;i++){
if(arr[i]!=arr[i-1]){
//cout << i<< endl;
cnt++;
}
}
cout << cnt << endl;
return 0;
}