import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	int n = read.to!int;
	long[] as = readln.split.map!(to!long).array;
	
	int count = 1;
	int trend = 9; // 0: none, 1: up, -1: down
	for(int i = 0; i < n; i ++){
		debug writeln(count, trend);
		if(trend == 9){
			trend = 0;
			}
		else if(trend == 0){
			if(as[i - 1] == as[i]) trend = 9;
			else if(as[i - 1] < as[i]) trend = 1;
			else if(as[i - 1] > as[i]) trend = -1;
			}
		else if(trend == 1){
			if(as[i - 1] < as[i]) continue;
			else trend = 0, count += 1;
			}
		else if(trend == -1){
			if(as[i - 1] > as[i]) continue;
			else trend = 0, count += 1;
			}
		}
	
	count.writeln;
	}