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 = 0;
	int trend = 0;
	bool hasOld = 0;
	long old = 0;
	for(int i = 0; i < n; i ++){
		debug writeln(i, " ", as[i], " ", old, " ", trend, " ", count);
		if(!hasOld){
			count += 1;
			debug "a".writeln;
			}
		else{
			if(trend != 0){
				if(trend > 0 && old <= as[i] || trend < 0 && old >= as[i]){
					debug "b".writeln;
					}
				else{
					trend = 0;
					count += 1;
					debug "c".writeln;
					}
				}
			else{
				if(old < as[i]) trend = 1;
				else if(old > as[i]) trend = -1;
				debug "d".writeln;
				}
			}
		old = as[i];
		hasOld = 1;
		debug writeln(i, " ", as[i], " ", old, " ", trend, " ", count);
		debug "-".writeln;
		}
	
	count.writeln;
	}