试题编号: | 201509-1 |
试题名称: | 数列分段 |
时间限制: | 1.0s |
内存限制: | 256.0MB |
/******************************************************************************
试题编号: 201509-1 试题名称: 数列分段 时间限制: 1.0s 内存限制: 256.0MB
*******************************************************************************/
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int a[] = new int[n];
int seg = 0;
for(int i = 0;i < n; i++){
a[i] = in.nextInt();
}
boolean flag = true;
int tmp=a[0];
for(int i = 1;i < n; i++){
if(a[i] ==tmp){
continue;
}else{
seg++;
tmp = a[i];
}
}
seg +=1;
System.out.println(seg);
}
}