Maria plays college basketball and wants to go pro.  Each season she maintains a record of her play.  She tabulates the number of times she breaks her season record for most points and least points in a game.  Points scored in the first game establish her record for the season, and she begins counting from there.

Example 

$scores=[12,24,10,24]$   

Scores are in the same order as the games played.  She tabulates her results as follows:

                                     Count
    Game  Score  Minimum  Maximum   Min Max
     0      12     12       12       0   0
     1      24     12       24       0   1
     2      10     10       24       1   1
     3      24     10       24       1   1

Given the scores for a season, determine the number of times Maria breaks her records for most and least points scored during the season.

Function Description  

Complete the breakingRecords function in the editor below. 

breakingRecords has the following parameter(s):  

int scores[n]: points scored per game   

Returns   

int[2]: An array with the numbers of times she broke her records. Index $0$ is for breaking most points records, and index $1$ is for breaking least points records.  

Input Format

The first line contains an integer $n$, the number of games. 

The second line contains $n$ space-separated integers describing the respective values of $score_0,score_1,...,score_{n-1}$.

Constraints

$1\leq n\leq1000$
$0\leq scores[i]\leq10^8$

Sample Input 0
9
10 5 20 20 4 5 2 25 1

Sample Output 0
2 4

Explanation 0

The diagram below depicts the number of times Maria broke her best and worst records throughout the season:

She broke her best record twice (after games $2$ and $7$) and her worst record four times (after games $1$, $4$, $\boldsymbol{6}$, and $8$), so we print 2 4 as our answer. Note that she did not break her record for best score during game $3$, as her score during that game was not strictly greater than her best record at the time.

Sample Input 1
10
3 4 21 36 10 28 35 5 24 42

Sample Output 1
4 0

Explanation 1

The diagram below depicts the number of times Maria broke her best and worst records throughout the season:

She broke her best record four times (after games $1$, $2$, $3$, and $\mbox{9}$) and her worst record zero times (no score during the season was lower than the one she earned during her first game), so we print 4 0 as our answer.

Source: hackerrank | Difficulty: EASY
Tags: Implementation


Solutions:
input()
a = list(map(int, input().split()))
m = M = a[0]
x = y = 0
for i in a[1:]:
	if i > M:
		M = i
		x += 1
	elif i < m:
		m = i
		y += 1
print(x, y)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
most = score[0]
least = score[0]
best = 0
worst = 0
for i in range(n):
	if score[i] > most:
		most = score[i]
		best += 1
	if score[i] < least:
		least = score[i]
		worst += 1
print(best, worst)


import sys
n = int(input().strip())
s = list(map(int, input().strip().split(' ')))
m = s[0]
bm = 0
M = s[0]
bM = 0
for si in s:
	if si < m:
		m = si
		bm += 1
	elif si > M:
		M = si
		bM += 1
print(bM, bm)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
minScore = score[0]
maxScore = score[0]
numPassMax = 0
numPassMin = 0
for i in score:
	if i > maxScore:
		numPassMax += 1
		maxScore = i
	elif i < minScore:
		numPassMin += 1
		minScore = i
print(numPassMax, numPassMin)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
minimum = score[0]
maksimum = score[0]
maksCount = 0
minCount = 0
for num in score[1:]:
	if num > maksimum:
		maksimum = num
		maksCount += 1
	elif num < minimum:
		minimum = num
		minCount += 1
print(maksCount, minCount)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
worst = score[0]
tot_be = 0
tot_wo = 0
for i in range(1, len(score)):
	if score[i] > best:
		tot_be += 1
		best = score[i]
	if score[i] < worst:
		tot_wo += 1
		worst = score[i]
print('{} {}'.format(tot_be, tot_wo))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
most = score[0]
least = score[0]
most_count = 0
least_count = 0
for s in score:
	if s > most:
		most = s
		most_count += 1
	elif s < least:
		least = s
		least_count += 1
print(most_count, least_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worst = best = score[0]
ans_best = 0
ans_worst = 0
for s in score:
	if s > best:
		ans_best += 1
		best = s
	if s < worst:
		ans_worst += 1
		worst = s
print(str(ans_best) + ' ' + str(ans_worst))


n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
m = 0
mk = score[0]
l = 0
lk = score[0]
for i in score:
	if i > mk:
		m += 1
		mk = i
	elif i < lk:
		l += 1
		lk = i
print(m, l)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
min = score[0]
max = score[0]
(la, li) = (0, 0)
for s in score:
	if s > max:
		max = s
		la += 1
	if s < min:
		min = s
		li += 1
print(la, li)


def solution(arr):
	lo = arr[0]
	hi = arr[0]
	lob = 0
	hib = 0
	for i in range(1, len(arr)):
		if arr[i] < lo:
			lob += 1
			lo = arr[i]
		if arr[i] > hi:
			hib += 1
			hi = arr[i]
	return [hib, lob]
size = int(input())
arr = [int(t) for t in input().strip().split()]
ans = solution(arr)
print(str(ans)[1:-1].replace(',', ''))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
worst = score[0]
best_count = 0
worst_count = 0
for i in range(1, len(score)):
	if score[i] < worst:
		worst = score[i]
		worst_count = worst_count + 1
	if score[i] > best:
		best = score[i]
		best_count = best_count + 1
print(best_count, worst_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
highest_count = 0
lowest_count = 0
highest = score[0]
lowest = score[0]
for i in range(n):
	if score[i] > highest:
		highest = score[i]
		highest_count += 1
	if score[i] < lowest:
		lowest = score[i]
		lowest_count += 1
print(highest_count, lowest_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
mx = score[0]
mn = score[0]
mxc = 0
mnc = 0
for x in score[1:]:
	if x > mx:
		mxc += 1
		mx = x
	if x < mn:
		mnc += 1
		mn = x
print(mxc, mnc)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
x = y = score[0]
a = b = 0
for z in score:
	if z > x:
		x = z
		a += 1
	if z < y:
		y = z
		b += 1
print(a, b)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(hn, hm, ln, lm) = (0, score[0], 0, score[0])
for i in score:
	if i > hm:
		hn += 1
		hm = i
	if i < lm:
		ln += 1
		lm = i
print(hn, ln)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
counx = 0
counn = 0
mini = score[0]
maxi = score[0]
for a in score:
	if a > maxi:
		counx += 1
		maxi = a
	elif a < mini:
		counn += 1
		mini = a
print(counx, counn)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worstRecord = score[0]
bestRecord = score[0]
countBest = 0
countWorst = 0
for i in range(1, len(score)):
	newScore = score[i]
	if newScore > bestRecord:
		countBest += 1
		bestRecord = newScore
	elif newScore < worstRecord:
		countWorst += 1
		worstRecord = newScore
print(str(countBest) + ' ' + str(countWorst))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxx = score[0]
minn = score[0]
countmax = 0
countmin = 0
for i in range(1, n):
	if score[i] > maxx:
		maxx = score[i]
		countmax += 1
	if score[i] < minn:
		minn = score[i]
		countmin += 1
print(countmax, countmin)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(ma, sma) = (0, 0)
hi = -1
lo = 1000000
for i in range(len(score)):
	if i == 0:
		hi = score[i]
		lo = score[i]
		continue
	if score[i] > hi:
		ma += 1
		hi = score[i]
	if score[i] < lo:
		lo = score[i]
		sma += 1
print(ma, sma)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
goodcount = 0
badcount = 0
currworst = score[0]
currbest = score[0]
if n > 1:
	for i in range(n):
		if score[i] > currbest:
			goodcount += 1
			currbest = score[i]
		if score[i] < currworst:
			badcount += 1
			currworst = score[i]
print(goodcount, badcount)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
i = 0
maxx = score[0]
maxxc = 0
minn = score[0]
minnc = 0
for i in range(1, n):
	if score[i] > maxx:
		maxx = score[i]
		maxxc = maxxc + 1
	if score[i] < minn:
		minn = score[i]
		minnc = minnc + 1
print(str(maxxc) + ' ' + str(minnc))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
be = 0
ls = 0
max = score[0]
min = score[0]
for i in score:
	if i > max:
		max = i
		be += 1
	if i < min:
		min = i
		ls += 1
print(be, ls)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
minimum = score[0]
maximum = score[0]
maxscores = 0
minscores = 0
for i in range(1, n):
	if score[i] > maximum:
		maxscores += 1
		maximum = score[i]
	if score[i] < minimum:
		minscores += 1
		minimum = score[i]
print(str(maxscores) + ' ' + str(minscores))


n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worst = 0
best = 0
_min = score[0]
_max = score[0]
for i in range(n):
	if score[i] > _max:
		best += 1
		_max = score[i]
	if score[i] < _min:
		worst += 1
		_min = score[i]
print(best, worst)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(best, bCount) = (score[0], 0)
(worst, wCount) = (score[0], 0)
for i in range(1, len(score)):
	if score[i] > best:
		bCount += 1
		best = score[i]
	elif score[i] < worst:
		wCount += 1
		worst = score[i]
print('{} {}'.format(bCount, wCount))


n = int(input())
s = [int(x) for x in input().split()]
best = s[0]
worst = s[0]
best_num = 0
worst_num = 0
for i in range(1, len(s)):
	if s[i] < worst:
		worst_num += 1
		worst = s[i]
	if s[i] > best:
		best_num += 1
		best = s[i]
print(str(best_num) + ' ' + str(worst_num))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
cmax = 0
cmin = 0
(mx, mn) = (score[0], score[0])
for i in range(1, len(score)):
	if mx > score[i]:
		cmax += 1
		mx = score[i]
	elif mn < score[i]:
		cmin += 1
		mn = score[i]
print(cmin, cmax)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
ma = 0
mi = 0
m = score[0]
im = m
for ch in score:
	if ch > m:
		m = ch
		ma += 1
	if ch < im:
		im = ch
		mi += 1
print(ma, mi)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split()))
bestbreak = 0
worstbreak = 0
max1 = score[0]
min1 = score[0]
i = 1
while i < len(score):
	if score[i] > max1:
		bestbreak += 1
		max1 = score[i]
	if score[i] < min1:
		worstbreak += 1
		min1 = score[i]
	i += 1
print(bestbreak, worstbreak)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(least_score, most_score) = (score[0], score[0])
(least_break, most_break) = (0, 0)
for i in range(1, len(score)):
	if score[i] > most_score:
		most_score = score[i]
		most_break += 1
	if score[i] < least_score:
		least_score = score[i]
		least_break += 1
print(most_break, least_break)


import sys
n = int(input())
a = list(map(int, input().strip().split()))
(ma, mi) = (a[0], a[0])
(ans1, ans2) = (0, 0)
for v in a:
	if v > ma:
		ans1 += 1
		ma = v
	if v < mi:
		ans2 += 1
		mi = v
print(ans1, ans2)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
rm = score[0]
rl = score[0]
nrm = 0
nrl = 0
for s in score[1:]:
	if s > rm:
		nrm += 1
		rm = s
	if s < rl:
		nrl += 1
		rl = s
print(nrm, nrl)


import sys
n = int(input().strip())
scores = list(map(int, input().strip().split(' ')))
highest = scores[0]
lowest = highest
del scores[0]
highInc = 0
lowInc = 0
for score in scores:
	if score > highest:
		highest = score
		highInc += 1
	if score < lowest:
		lowest = score
		lowInc += 1
print('%d %d' % (highInc, lowInc))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
sum = 0
count = 0
for (j, i) in enumerate(score):
	if j == 0:
		x = i
		y = i
	if i > x:
		sum += 1
		x = i
	if i < y:
		count += 1
		y = i
print(sum, count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
most = score[0]
least = score[0]
mcount = 0
lcount = 0
for i in range(1, n):
	if score[i] > most:
		most = score[i]
		mcount = mcount + 1
	if score[i] < least:
		least = score[i]
		lcount = lcount + 1
print('{} {}'.format(mcount, lcount))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
worst = score[0]
best_count = 0
worst_count = 0
for s in score[1:]:
	if s > best:
		best = s
		best_count += 1
	if s < worst:
		worst = s
		worst_count += 1
print(best_count, worst_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
max = score[0]
min = score[0]
countmax = 0
countmin = 0
for i in range(1, len(score) + 1):
	for j in range(i):
		if score[j] > max:
			max = score[j]
			countmax += 1
		if score[j] < min:
			min = score[j]
			countmin += 1
print(countmax, countmin)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxi = 0
mini = 0
for i in range(1, n):
	if max(score[:i]) < score[i]:
		maxi += 1
	if min(score[:i]) > score[i]:
		mini += 1
print(maxi, mini)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxx = minn = score[0]
up = down = 0
for i in range(1, n):
	if score[i] > maxx:
		maxx = score[i]
		up += 1
	elif score[i] < minn:
		minn = score[i]
		down += 1
print(str(up) + ' ' + str(down))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
mx = score[0]
mx_cnt = 0
mn = score[0]
mn_cnt = 0
for i in range(1, len(score)):
	if score[i] > mx:
		mx_cnt += 1
		mx = score[i]
	if score[i] < mn:
		mn_cnt += 1
		mn = score[i]
print(mx_cnt, mn_cnt, sep=' ')


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
temp = []
min = 0
max = 0
temp.append(score[0])
for i in range(1, n):
	temp.sort()
	if score[i] < temp[0]:
		min = min + 1
	elif score[i] > temp[i - 1]:
		max = max + 1
	temp.append(score[i])
print(max, min)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))

def bestworst(games, score):
	bestct = 0
	worstct = 0
	best = score[0]
	worst = score[0]
	for (i, v) in enumerate(score):
		if v > best:
			bestct += 1
			best = score[i]
		if v < worst:
			worstct += 1
			worst = score[i]
	return str(bestct) + ' ' + str(worstct)
print(bestworst(n, score))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
b = score[0]
w = score[0]
l = 0
l1 = 0
for i in range(len(score)):
	if score[i] > b:
		b = score[i]
		l += 1
	if score[i] < w:
		w = score[i]
		l1 += 1
print(l, l1)


import sys
n = int(input().strip())
scores = list(map(int, input().strip().split(' ')))
maxs = scores[0]
mins = scores[0]
bcount = 0
wcount = 0
for score in scores[1:]:
	if score > maxs:
		bcount += 1
		maxs = score
	elif score < mins:
		wcount += 1
		mins = score
print(bcount, wcount)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best_r = score[0]
best_r_count = 0
worst_r = score[0]
worst_r_count = 0
for val in score:
	if val > best_r:
		best_r = val
		best_r_count += 1
	if val < worst_r:
		worst_r = val
		worst_r_count += 1
print(best_r_count, worst_r_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
min = score[0]
max = score[0]
c = 0
d = 0
for i in range(1, len(score)):
	if score[i] > min:
		min = score[i]
		c += 1
	if score[i] < max:
		max = score[i]
		d += 1
print(c, d)


import math
import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
n0 = 0
maxxy = -float('inf')
maxcount = -1
minny = float('inf')
mincount = -1
while n0 < n:
	if score[n0] > maxxy:
		maxxy = score[n0]
		maxcount += 1
	if score[n0] < minny:
		minny = score[n0]
		mincount += 1
	n0 += 1
print(maxcount, mincount)


import sys
n = int(input())
s = list(map(int, input().split(' ')))
r = []
c1 = c2 = 0
r.append(s[0])
for i in range(1, len(s)):
	a = min(r)
	b = max(r)
	if s[i] > b:
		c1 += 1
		r.append(s[i])
	elif s[i] < a:
		c2 = c2 + 1
		r.append(s[i])
	else:
		r.append(s[i])
print(str(c1) + ' ' + str(c2))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(low, high) = (score[0], score[0])
lowC = 0
highC = 0
for i in score:
	if i < low:
		lowC += 1
		low = i
	if i > high:
		highC += 1
		high = i
print(highC, lowC)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
worst = score[0]
bestTimes = 0
worstTimes = 0
for i in score:
	if i > best:
		bestTimes += 1
		best = i
	if i < worst:
		worstTimes += 1
		worst = i
print(bestTimes, worstTimes)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
cm = score[0]
cmi = score[0]
ci = int()
cd = int()
for i in range(1, n):
	if score[i] < cmi:
		cmi = score[i]
		cd = cd + 1
	elif score[i] > cm:
		cm = score[i]
		ci = ci + 1
print(str(ci) + ' ' + str(cd))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxrec = 0
minrec = 0
maxi = score[0]
mini = score[0]
for item in score[1:]:
	if item < mini:
		mini = item
		minrec += 1
	elif item > maxi:
		maxi = item
		maxrec += 1
print(maxrec, minrec)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
mini = score[0]
maxi = score[0]
score1 = 0
score2 = 0
for i in score:
	if mini > i:
		mini = i
		score1 += 1
	if maxi < i:
		maxi = i
		score2 += 1
print(score2, score1)


import sys
hc = 0
lc = 0
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
hvalue = score[0]
lvalue = score[0]
for x in range(1, n):
	if score[x] > hvalue:
		hc = hc + 1
		hvalue = score[x]
	if score[x] < lvalue:
		lc = lc + 1
		lvalue = score[x]
print(str(hc) + ' ' + str(lc))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
tmp = score[0]
b = tmp
w = tmp
c_b = 0
c_w = 0
for i in range(1, n):
	if score[i] < w:
		w = score[i]
		c_w += 1
	if score[i] > b:
		b = score[i]
		c_b += 1
print(c_b, c_w)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
minS = score[0]
maxS = score[0]
breakMax = 0
breakMin = 0
for s in score:
	if s > maxS:
		breakMax = breakMax + 1
		maxS = s
	if s < minS:
		breakMin = breakMin + 1
		minS = s
print(str(breakMax) + ' ' + str(breakMin))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
minimum = score[0]
maximum = score[0]
maxcount = 0
mincount = 0
for i in range(len(score)):
	if score[i] > maximum:
		maxcount += 1
		maximum = score[i]
	elif score[i] < minimum:
		mincount += 1
		minimum = score[i]
print(maxcount, end=' ')
print(mincount)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worst = best = score[0]
worsts = bests = 0
for i in score:
	if i == worst:
		pass
	elif i > best:
		best = i
		bests += 1
	elif i < worst:
		worst = i
		worsts += 1
print(bests, worsts)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxi = score[0]
mini = maxi
(a, b) = (0, 0)
for s in score:
	if s > maxi:
		a += 1
		maxi = s
	if s < mini:
		b += 1
		mini = s
print(a, end=' ')
print(b)


import math
n = input()
a = map(int, input().split())
(min_element, max_element) = (0, 0)
(min_count, max_count) = (0, 0)
for (i, element) in enumerate(a):
	if i > 0:
		if min_element > element:
			min_count += 1
			min_element = element
		if max_element < element:
			max_count += 1
			max_element = element
	else:
		min_element = element
		max_element = element
print(max_count, min_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
max = score[0]
min = score[0]
cntmin = 0
cntmax = 0
for i in range(1, n):
	if score[i] < min:
		min = score[i]
		cntmin += 1
	if score[i] > max:
		max = score[i]
		cntmax += 1
print(cntmax, cntmin)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
worst = score[0]
count_best = 0
count_worst = 0
for i in score:
	if i > best:
		best = i
		count_best += 1
	elif i < worst:
		worst = i
		count_worst += 1
print(count_best, count_worst)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
most = score[0]
least = score[0]
(a, b) = (0, 0)
for i in range(1, n):
	if score[i] > most:
		a = a + 1
		most = score[i]
	elif score[i] < least:
		b = b + 1
		least = score[i]
print(str(a) + ' ' + str(b))


n = int(input())
s = list(map(int, input().split()))
mini = s[0]
maxi = mini
a = b = 0
for e in s:
	if e > maxi:
		maxi = e
		a += 1
	if e < mini:
		mini = e
		b += 1
print(a, b)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = -1
worst = 100000001
bestCount = -1
worstCount = -1
for i in range(n):
	if score[i] > best:
		bestCount += 1
		best = score[i]
	if score[i] < worst:
		worstCount += 1
		worst = score[i]
print('%d %d' % (bestCount, worstCount))


n = int(input())
l = list(map(int, input().split(' ')))
maxi = mini = l[0]
max_count = min_count = 0
for i in range(1, n):
	if l[i] > maxi:
		max_count += 1
		maxi = l[i]
	if l[i] < mini:
		min_count += 1
		mini = l[i]
print(max_count, min_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
worst = score[0]
a = 0
b = 0
for s in score[1:]:
	if s > best:
		a += 1
		best = s
	if s < worst:
		b += 1
		worst = s
print('{} {}'.format(a, b))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxN = 0
minN = 0
max_so_far = score[0]
min_so_far = score[0]
for number in range(1, n):
	if score[number] > max_so_far:
		max_so_far = score[number]
		maxN = maxN + 1
	elif score[number] < min_so_far:
		min_so_far = score[number]
		minN = minN + 1
print(str(maxN) + ' ' + str(minN))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(max, min) = (score[0], score[0])
icnt = 0
ccnt = 0
for i in score:
	if i > max:
		max = i
		icnt = icnt + 1
	elif i < min:
		min = i
		ccnt = ccnt + 1
print(icnt, end=' ')
print(ccnt)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
mins = score[0]
maxs = score[0]
better = 0
worse = 0
for s in score:
	if s < mins:
		mins = s
		worse += 1
	if s > maxs:
		maxs = s
		better += 1
print(better, worse)


n = int(input())
l = list(map(int, input().split()))
mi = ma = l[0]
a = b = 0
for i in range(1, len(l)):
	if l[i] < mi:
		a += 1
		mi = l[i]
	if l[i] > ma:
		b += 1
		ma = l[i]
print('{} {}'.format(b, a))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
count1 = 0
count2 = 0
init1 = score[0]
init2 = score[0]
for i in range(1, len(score)):
	if init1 < score[i]:
		init1 = score[i]
		count1 += 1
	if init2 > score[i]:
		init2 = score[i]
		count2 += 1
print(count1, count2)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
cntmax = 0
cntmin = 0
accmax = score[0]
accmin = score[0]
for s in score[1:]:
	if s > accmax:
		accmax = s
		cntmax += 1
	elif s < accmin:
		accmin = s
		cntmin += 1
print(cntmax, cntmin)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
Min = score[0]
Max = score[0]
wcnt = 0
bcnt = 0
for i in range(1, n):
	if score[i] < Min:
		wcnt += 1
		Min = score[i]
	elif score[i] > Max:
		bcnt += 1
		Max = score[i]
	else:
		continue
print(bcnt, wcnt)


import sys
n = int(input().strip())
(maksiInd, miniInd) = (0, 0)
score = list(map(int, input().strip().split(' ')))
maksi = score[0]
mini = score[0]
for i in range(1, n):
	if score[i] > maksi and score[i] > score[i - 1]:
		maksi = score[i]
		maksiInd += 1
	elif score[i] < score[i - 1] and score[i] < mini:
		mini = score[i]
		miniInd += 1
print(maksiInd, miniInd)


import sys
n = int(input().strip())
scores = list(map(int, input().strip().split(' ')))
worst = scores[0]
best = scores[0]
bestCount = 0
worstCount = 0
for score in scores:
	if score > best:
		bestCount += 1
		best = score
	if score < worst:
		worstCount += 1
		worst = score
print(bestCount, worstCount)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worst = best = score[0]
worst_count = best_count = 0
for i in score:
	if i > best:
		best_count += 1
		best = i
	elif i < worst:
		worst_count += 1
		worst = i
print(best_count, worst_count)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
least = score[0]
bb = 0
bl = 0
for i in score[1:n]:
	if i > best:
		best = i
		bb = bb + 1
	if i < least:
		least = i
		bl = bl + 1
print(bb, bl)


import sys
n = int(input().strip())
inp = input().strip().split(' ')
temp_min = temp_max = int(inp[0])
ans_0 = ans_1 = 0
for i in range(1, n):
	n = int(inp[i])
	if n > temp_max:
		temp_max = n
		ans_0 += 1
	elif n < temp_min:
		temp_min = n
		ans_1 += 1
print(ans_0, ans_1)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
b = w = 0
bl = wl = score[0]
for i in range(len(score)):
	if score[i] > bl:
		b += 1
		bl = score[i]
	if score[i] < wl:
		w += 1
		wl = score[i]
print(b, w)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = worst = score[0]
win = 0
lose = 0
for num in score:
	if num > best:
		best = num
		win += 1
	if num < worst:
		worst = num
		lose += 1
print(win, lose)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
s = 0
b = 0
s1 = score[0]
s2 = score[0]
for scores in score:
	if scores > s1:
		s1 = scores
		s += 1
	if scores < s2:
		s2 = scores
		b += 1
print(str(s) + ' ' + str(b))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worst = score[0]
best = score[0]
best_record = 0
worst_record = 0
for i in range(1, n):
	if score[i] > best:
		best_record += 1
		best = score[i]
	elif score[i] < worst:
		worst_record += 1
		worst = score[i]
print(best_record, worst_record)


import sys
n = int(input().strip())
lst = list(map(int, input().strip().split(' ')))
(i, j, x) = (1, 1, lst[0])
(most, least) = (0, 0)
while i < len(lst):
	if x > lst[i]:
		x = lst[i]
		least += 1
	i += 1
x = lst[0]
while j < len(lst):
	if x < lst[j]:
		x = lst[j]
		most += 1
	j += 1
print(most, least)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
(m, m1) = (score[0], score[0])
(f, f1) = (0, 0)
for i in score[1:]:
	if i < m:
		f = f + 1
		m = i
	if i > m1:
		f1 = f1 + 1
		m1 = i
print(str(f1) + ' ' + str(f))


import sys
(mxcnt, micnt) = (0, 0)
n = int(input().strip())
s = list(map(int, input().strip().split(' ')))
max = s[0]
min = s[0]
for i in range(1, len(s)):
	if s[i] > max:
		max = s[i]
		mxcnt = mxcnt + 1
	if s[i] < min:
		min = s[i]
		micnt = micnt + 1
print(mxcnt, micnt)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
MM = [score[0], score[0]]
Count = [0, 0]
for i1 in score[1:]:
	if i1 < MM[0]:
		MM[0] = i1
		Count[0] += 1
	elif i1 > MM[1]:
		MM[1] = i1
		Count[1] += 1
print(Count[1], Count[0])


n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
maxi = mini = score[0]
CMax = 0
CMin = 0
for i in score:
	if maxi < i:
		CMax += 1
		maxi = i
	elif mini > i:
		CMin += 1
		mini = i
print('{} {}'.format(CMax, CMin))


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
max1 = score[0]
min1 = score[0]
maxcount = 0
mincount = 0
for i in range(1, n):
	m = score[i]
	if m < min1:
		mincount += 1
		min1 = m
	if m > max1:
		maxcount += 1
		max1 = m
print(maxcount, mincount)


n = int(input())
lst = list(map(int, input().split()))
best_record = lst[0]
(best_count, worst_count) = (0, 0)
worst_record = lst[0]
for each_score in lst:
	if each_score > best_record:
		best_count += 1
		best_record = each_score
	if each_score < worst_record:
		worst_count += 1
		worst_record = each_score
print(best_count, worst_count)


import sys
n = int(input().strip())
b = input()
l = []
l1 = b.split()
for i in range(n):
	a = int(l1[i])
	if i == 0:
		l.append(a)
		l.append(a)
		l.append(0)
		l.append(0)
	elif a < l[0]:
		l[0] = a
		l[2] = l[2] + 1
	elif a > l[1]:
		l[1] = a
		l[3] = l[3] + 1
print(l[3], l[2])


input()
l = list(map(int, input().split()))
most = l[0]
mCount = 0
least = l[0]
lCount = 0
for item in l:
	if item > most:
		most = item
		mCount += 1
	if item < least:
		least = item
		lCount += 1
print(mCount, lCount)


n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
best = score[0]
least = score[0]
brokeBest = 0
brokeLeast = 0
for i in range(1, n):
	if score[i] > best:
		best = score[i]
		brokeBest += 1
	elif score[i] < least:
		least = score[i]
		brokeLeast += 1
print(brokeBest, brokeLeast)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
worst = score[0]
best = score[0]
w_count = 0
b_count = 0
for i in range(1, n):
	if score[i] > best:
		b_count += 1
		best = score[i]
	if score[i] < worst:
		w_count += 1
		worst = score[i]
print(b_count, w_count)


import sys

def print_score(n, score):
	high = score[0]
	count_h = 0
	low = score[0]
	count_l = 0
	for i in range(1, n):
		if score[i] > high:
			high = score[i]
			count_h += 1
		if score[i] < low:
			low = score[i]
			count_l += 1
	print(str(count_h) + ' ' + str(count_l))
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
if n < 1:
	print('0 0')
else:
	print_score(n, score)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split()))
minv = maxv = score[0]
minc = maxc = 0
for s in score:
	if s < minv:
		minc += 1
		minv = s
	if s > maxv:
		maxc += 1
		maxv = s
print(maxc, minc)


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
score = list(score)
maxe = score[0]
mini = score[0]
maxcount = 0
mincount = 0
for x in score:
	if x > maxe:
		maxe = x
		maxcount += 1
	if x < mini:
		mini = x
		mincount += 1
print(maxcount, mincount, sep=' ')


import sys
n = int(input().strip())
score = list(map(int, input().strip().split(' ')))
max = score[0]
min = score[0]
cmax = 0
cmin = 0
for s in score:
	if s > max:
		max = s
		cmax = cmax + 1
	if s < min:
		min = s
		cmin = cmin + 1
print(cmax, cmin)