package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func CF1350C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	const mx int = 2e5
	lpf := [mx + 1]int{1: 1}
	for i := 2; i <= mx; i++ {
		if lpf[i] == 0 {
			for j := i; j <= mx; j += i {
				if lpf[j] == 0 {
					lpf[j] = i
				}
			}
		}
	}
	var n, v int
	Fscan(in, &n)
	ps := [mx][]int{}
	for i := 0; i < n; i++ {
		Fscan(in, &v)
		for v > 1 {
			p, e := lpf[v], 1
			for v /= p; lpf[v] == p; v /= p {
				e++
			}
			ps[p] = append(ps[p], e)
		}
	}
	ans := int64(1)
	for p, es := range ps {
		if len(es) >= n-1 {
			sort.Ints(es)
			for e := es[len(es)-n+1]; e > 0; e-- {
				ans *= int64(p)
			}
		}
	}
	Fprint(_w, ans)
}

func main() { CF1350C(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	a := ScanInt64Slice(n)
	a = append([]int64{0}, a...)
	//n := 4
	//a := []int{0, 10, 24, 40, 80}

	gcdAns := solv(n, a)

	P(gcdAns)

	close(O)
	oWg.Wait()
}

func solv(n int, a []int64) int64 {
	sfx := make([]int64, n+1)
	pre := make([]int64, n+1)
	pre[1] = a[1]
	sfx[n] = a[n]

	for i := n - 1; i >= 1; i-- {
		sfx[i] = GCD(sfx[i+1], a[i])
	}

	for i := 1; i <= n; i++ {
		pre[i] = GCD(a[i], pre[i-1])
	}
	//P("inp: ", a)
	//P("suf: ", sfx)
	//P("prf: ", pre)

	ans := int64(0)
	for i := 0; i <= n-1; i++ {
		if i == 0 {
			ans = sfx[2]
		} else if i == n-1 {
			ans = ans * pre[n-1] / GCD(pre[n-1], ans)
		} else {
			ans = ans * GCD(pre[i], sfx[i+2]) / GCD(GCD(pre[i], sfx[i+2]), ans)
		}
	}
	return ans
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func
S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	a := ScanInt64Slice(n)
	a = append([]int64{0}, a...)
	//n := 4
	//a := []int64{0, 10, 24, 40, 80}

	gcdAns := solv2(n, a)

	P(gcdAns)

	close(O)
	oWg.Wait()
}

func solv2(n int, a []int64) int64 {
	suf := make([]int64, n+2)
	suf[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		suf[i] = GCD(suf[i+1], a[i])
	}
	//P("Suf:", suf)

	b := make([]int64, n+1)
	for i := 1; i <= n; i++ {
		b[i] = (a[i] * suf[i+1]) / GCD(a[i], suf[i+1])
	}
	//P("b:", b)

	ans := b[1]
	for i := 2; i <= n; i++ {
		ans = GCD(ans, b[i])
	}
	//P("ans", ans)
	return ans
}

func solv1(n int, a []int64) int64 {
	sfx := make([]int64, n+1)
	pre := make([]int64, n+1)
	pre[1] = a[1]
	sfx[n] = a[n]

	for i := n - 1; i >= 1; i-- {
		sfx[i] = GCD(sfx[i+1], a[i])
	}

	for i := 1; i <= n; i++ {
		pre[i] = GCD(a[i], pre[i-1])
	}
	//P("inp: ", a)
	//P("suf: ", sfx)
	//P("prf: ", pre)

	ans := int64(0)
	for i := 0; i <= n-1; i++ {
		if i == 0 {
			ans = sfx[2]
		} else if i == n-1 {
			ans = ans * pre[n-1] / GCD(pre[n-1], ans)
		} else {
			ans = ans * GCD(pre[i], sfx[i+2]) / GCD(GCD(pre[i], sfx[i+2]), ans)
		}
	}
	return ans
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func
S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}

func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const N = 100010
var n int
var a[N] int64

func gcd(a int64, b int64) int64 {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a int64, b int64) int64 {
	var z = gcd(a, b)
	return a / z * b
}

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &n)
	for i := 1; i <= n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	var suGcd = make([]int64, n + 1)
	var z = make([]int64, n + 1)

	suGcd[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		suGcd[i] = gcd(suGcd[i + 1], a[i])
	}

	for i := 1; i < n; i++ {
		z[i] = lcm(a[i], suGcd[i + 1])
	}

	var ret = z[1]
	for i := 2; i < n; i++ {
		ret = gcd(ret, z[i])
	}

	fmt.Fprintf(writer, "%d\n", ret)
}

package main

import "fmt"

func pow(n, p int) int64 {
	if p == 0 {
		return 1
	}
	ret := pow(n, p/2)
	ret = ret * ret
	if p%2 == 1 {
		ret *= int64(n)
	}
	return ret
}

func main() {
	n := int(1e6)*2 + 10
	data := make([]int, n+1)
	for i := 2; i <= n; i++ {
		if data[i] != 0 {
			continue
		}
		data[i] = i
		if i > n/i {
			continue
		}
		for j := i * i; j <= n; j += i {
			if data[j] == 0 {
				data[j] = i
			}
		}
	}

	factors := func(n int) map[int]int {
		ret := make(map[int]int)
		for n > 1 {
			ret[data[n]]++
			n /= data[n]
		}
		return ret
	}

	fmt.Scan(&n)
	min1 := make(map[int]int)
	min2 := make(map[int]int)
	cnt := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		for k, v := range factors(a) {
			if min1[k] == 0 || min1[k] > v {
				min2[k] = min1[k]
				min1[k] = v
			} else if min2[k] == 0 || min2[k] > v {
				min2[k] = v
			}
			cnt[k]++
		}
	}

	ans := int64(1)
	for k, v := range cnt {
		if v == n-1 {
			ans *= pow(k, min1[k])
		}
		if v == n {
			ans *= pow(k, min2[k])
		}
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	n := reader.NextInt64()
	a := make([]int64, n)
	for i := range a {
		a[i] = reader.NextInt64()
	}
	writer.Printf("%d\n", sol(a))
}

func sol(a []int64) int64 {
	if len(a) == 1 {
		return a[0]
	}
	pref := make([]int64, len(a))
	pref[0] = a[0]
	for i := 1; i < len(a); i++ {
		pref[i] = gcd(pref[i-1], a[i])
	}
	suf := make([]int64, len(a))
	suf[len(suf)-1] = a[len(a)-1]
	for i := len(a)-2; i >= 0; i-- {
		suf[i] = gcd(suf[i+1], a[i])
	}
	ret := int64(1)
	for i := range a {
		if i == 0 {
			ret = lcm(ret, suf[1])
			continue
		}
		if i == len(a)-1 {
			ret = lcm(ret, pref[len(pref)-2])
			continue
		}
		ret = lcm(ret, gcd(pref[i-1], suf[i+1]))
	}
	return ret
}

/*
URL:
https://codeforces.com/problemset/problem/1349/A
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int64

	P [200000 + 5][]int64
)

func main() {
	n = ReadInt()
	A = ReadInt64Slice(n)

	for i := 0; i < n; i++ {
		if A[i] == 1 {
			continue
		}

		memo := TrialDivision(A[i])
		for k, v := range memo {
			P[k] = append(P[k], v)
		}
	}

	ans := int64(1)
	for i := 0; i <= 200000; i++ {
		if len(P[i]) >= n-1 {
			sort.Slice(P[i], func(j, k int) bool { return P[i][j] < P[i][k] })

			var e int64
			if len(P[i]) == n-1 {
				e = P[i][0]
			} else {
				e = P[i][1]
			}
			ans *= PowInt(int64(i), e)
		}
	}
	fmt.Println(ans)
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int64) int64 {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int64) map[int64]int64 {
	var i, exp int64
	p := map[int64]int64{}

	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	for i = 2; i*i <= n; i++ {
		exp = 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1350/problem/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int64
)

func main() {
	n = ReadInt()
	A = ReadInt64Slice(n)

	F, B := make([]int64, n), make([]int64, n)
	F[0] = A[0]
	for i := 1; i < n; i++ {
		F[i] = Gcd(F[i-1], A[i])
	}
	B[n-1] = A[n-1]
	for i := n - 2; i >= 0; i-- {
		B[i] = Gcd(B[i+1], A[i])
	}

	D := make([]int64, n)
	D[0] = B[1]
	D[n-1] = F[n-2]
	for i := 1; i < n-1; i++ {
		D[i] = Gcd(F[i-1], B[i+1])
	}

	ans := int64(1)
	for i := 0; i < n; i++ {
		ans = Lcm(ans, D[i])
	}
	fmt.Println(ans)
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int64) int64 {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int64) int64 {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1350/problem/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int

	memo [200000 + 50][30 + 5]int
)

func main() {
	n = ReadInt()
	A = ReadIntSlice(n)

	F, B := make([]int, n), make([]int, n)
	F[0] = A[0]
	for i := 1; i < n; i++ {
		F[i] = Gcd(F[i-1], A[i])
	}
	B[n-1] = A[n-1]
	for i := n - 2; i >= 0; i-- {
		B[i] = Gcd(B[i+1], A[i])
	}

	D := make([]int, n)
	D[0] = B[1]
	D[n-1] = F[n-2]
	for i := 1; i < n-1; i++ {
		D[i] = Gcd(F[i-1], B[i+1])
	}

	ans := 1
	for i := 0; i < n; i++ {
		ans = Lcm(ans, D[i])
	}
	fmt.Println(ans)
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int) map[int]int {
	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	p := map[int]int{}
	for i := 2; i*i <= n; i++ {
		exp := 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
func CF1350C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	const mx int = 2e5
	lpf := [mx + 1]int{1: 1}
	for i := 2; i <= mx; i++ {
		if lpf[i] == 0 {
			for j := i; j <= mx; j += i {
				if lpf[j] == 0 {
					lpf[j] = i
				}
			}
		}
	}
	var n, v int
	Fscan(in, &n)
	ps := [mx][]int{}
	for i := 0; i < n; i++ {
		Fscan(in, &v)
		for v > 1 {
			p, e := lpf[v], 1
			for v /= p; lpf[v] == p; v /= p {
				e++
			}
			ps[p] = append(ps[p], e)
		}
	}
	ans := 1
	for p, es := range ps {
		if len(es) >= n-1 {
			sort.Ints(es)
			for e := es[len(es)-n+1]; e > 0; e-- {
				ans *= p
			}
		}
	}
	Fprint(_w, ans)
}

func main() { CF1350C(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	a := ScanIntSlice(n)
	a = append([]int{0}, a...)
	//n := 4
	//a := []int{0, 10, 24, 40, 80}

	gcdAns := solv(n, a)

	P(gcdAns)

	close(O)
	oWg.Wait()
}

func solv(n int, a []int) int {
	sfx := make([]int, n+1)
	pre := make([]int, n+1)

	for i := n - 1; i >= 1; i-- {
		sfx[i] = GCD(sfx[i+1], a[i])
	}

	for i := 1; i <= n; i++ {
		pre[i] = GCD(a[i], pre[i-1])
	}
	//P("inp: ", a)
	//P("suf: ", sfx)
	//P("prf: ", pre)

	ans := 0
	for i := 0; i <= n-1; i++ {
		if i == 0 {
			ans = sfx[2]
		} else if i == n-1 {
			ans = ans * pre[n-1] / GCD(pre[n-1], ans)
		} else {
			ans = ans * GCD(pre[i], sfx[i+2]) / GCD(GCD(pre[i], sfx[i+2]), ans)
		}
	}
	return ans
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func
S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int       { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	a := ScanIntSlice(n)
	a = append([]int{0}, a...)
	//n := 4
	//a := []int{0, 10, 24, 40, 80}

	gcdAns := solv(n, a)

	P(gcdAns)

	close(O)
	oWg.Wait()
}

func solv(n int, a []int) int {
	sfx := make([]int, n+1)
	pre := make([]int, n+1)
	pre[1]=a[1]
	sfx[n]=a[n]

	for i := n - 1; i >= 1; i-- {
		sfx[i] = GCD(sfx[i+1], a[i])
	}

	for i := 1; i <= n; i++ {
		pre[i] = GCD(a[i], pre[i-1])
	}
	//P("inp: ", a)
	//P("suf: ", sfx)
	//P("prf: ", pre)

	ans := 0
	for i := 0; i <= n-1; i++ {
		if i == 0 {
			ans = sfx[2]
		} else if i == n-1 {
			ans = ans * pre[n-1] / GCD(pre[n-1], ans)
		} else {
			ans = ans * GCD(pre[i], sfx[i+2]) / GCD(GCD(pre[i], sfx[i+2]), ans)
		}
	}
	return ans
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func
S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int       { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	//n := ScanInt()
	//a := ScanIntSlice(n)
	n := 4
	a := []int{0, 10, 24, 40, 80}

	gcdAns := solv(n, a)

	P("g: ", gcdAns)

	close(O)
	oWg.Wait()
}

func solv(n int, a []int) int {
	sfx := make([]int, n+1)
	pre := make([]int, n+1)

	for i := n - 1; i >= 1; i-- {
		sfx[i] = GCD(sfx[i+1], a[i])
	}

	for i := 1; i <= n; i++ {
		pre[i] = GCD(a[i], pre[i-1])
	}
	P("inp: ", a)
	P("suf: ", sfx)
	P("prf: ", pre)

	ans := 0
	for i := 0; i <= n-1; i++ {
		if i == 0 {
			ans = sfx[2]
		} else if i == n-1 {
			ans = ans * pre[n-1] / GCD(pre[n-1], ans)
		} else {
			ans = ans * GCD(pre[i], sfx[i+2]) / GCD(GCD(pre[i], sfx[i+2]), ans)
		}
	}
	return ans
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func
S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int       { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const N = 100010
var n int
var a[N] int

func gcd(a int, b int) int {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a int, b int) int {
	var z = gcd(a, b)
	return a / z * b
}

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &n)
	for i := 1; i <= n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	var suGcd = make([]int, n + 1)
	var z = make([]int, n + 1)

	suGcd[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		suGcd[i] = gcd(suGcd[i + 1], a[i])
	}
	z[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		z[i] = lcm(suGcd[i + 1], a[i])
	}

	var ret = z[1]
	for i := 2; i < n; i++ {
		ret = gcd(ret, z[i])
	}

	fmt.Fprintf(writer, "%d\n", ret)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const N = 100010
var n int
var a[N] int

func gcd(a int, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return gcd(a % b, b)
}

func lcm(a int, b int) int {
	var z = gcd(a, b)
	return a / z * b
}

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &n)
	for i := 1; i <= n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	var suGcd = make([]int, n + 1)
	var z = make([]int, n + 1)

	suGcd[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		suGcd[i] = gcd(suGcd[i + 1], a[i])
	}
	z[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		z[i] = lcm(suGcd[i + 1], a[i])
	}

	var ret = z[1]
	for i := 2; i <= n; i++ {
		ret = gcd(ret, z[i])
	}

	fmt.Fprintf(writer, "%d\n", ret)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const N = 100010
var n int
var a[N] int

func gcd(a int, b int) int {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

func lcm(a int, b int) int {
	var z = gcd(a, b)
	return a / z * b
}

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &n)
	for i := 1; i <= n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	var suGcd = make([]int, n + 1)
	var z = make([]int, n + 1)

	suGcd[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		suGcd[i] = gcd(suGcd[i + 1], a[i])
	}
	z[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		z[i] = lcm(suGcd[i + 1], a[i])
	}

	var ret = z[1]
	for i := 2; i <= n; i++ {
		ret = gcd(ret, z[i])
	}

	fmt.Fprintf(writer, "%d\n", ret)
}

package main

import "fmt"

func main() {
	n := int(1e6)*2 + 10
	data := make([]int, n+1)
	for i := 2; i <= n; i++ {
		if data[i] != 0 {
			continue
		}
		data[i] = i
		if i > n/i {
			continue
		}
		for j := i * i; j <= n; j += i {
			if data[j] == 0 {
				data[j] = i
			}
		}
	}

	factors := func(n int) map[int]int {
		ret := make(map[int]int)
		for n > 1 {
			ret[data[n]]++
			n /= data[n]
		}
		return ret
	}

	fmt.Scan(&n)
	min1 := make(map[int]int)
	min2 := make(map[int]int)
	cnt := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		for k, v := range factors(a) {
			if min1[k] == 0 || min1[k] > v {
				min2[k] = min1[k]
				min1[k] = v
			} else if min2[k] == 0 || min2[k] > v {
				min2[k] = v
			}
			cnt[k]++
		}
	}

	var pow func(n, p int) int64
	pow = func(n, p int) int64 {
		if p == 0 {
			return 1
		}
		ret := pow(n, p/2)
		ret = ret * ret
		if p%2 == 1 {
			ret *= int64(n)
		}
		return ret
	}

	ans := int64(1)
	for k, v := range cnt {
		if v < n-1 {
			continue
		}
		ans *= pow(k, min2[k])
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	n := int(1e6)*2 + 10
	data := make([]int, n+1)
	for i := 2; i <= n; i++ {
		if data[i] != 0 {
			continue
		}
		data[i] = i
		if i > n/i {
			continue
		}
		for j := i * i; j <= n; j += i {
			if data[j] == 0 {
				data[j] = i
			}
		}
	}

	factors := func(n int) map[int]int {
		ret := make(map[int]int)
		for n > 1 {
			ret[data[n]]++
			n /= data[n]
		}
		return ret
	}

	fmt.Scan(&n)
	min1 := make(map[int]int)
	min2 := make(map[int]int)
	cnt := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		for k, v := range factors(a) {
			m1, ok1 := min1[k]
			m2, ok2 := min2[k]
			if !ok1 || m1 > v {
				if ok1 {
					min2[k] = min1[k]
				}
				min1[k] = v
			} else if !ok2 || m2 > v {
				min2[k] = v
			}
			cnt[k]++
		}
	}

	var pow func(n, p int) int64
	pow = func(n, p int) int64 {
		if p == 0 {
			return 1
		}
		ret := pow(n, p/2)
		ret = ret * ret
		if p%2 == 1 {
			ret *= int64(n)
		}
		return ret
	}

	ans := int64(1)
	for k, v := range cnt {
		if v < n-1 {
			continue
		}
		ans *= pow(k, min2[k])
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	n := int(1e6)*2 + 10
	data := make([]int, n+1)
	for i := 2; i <= n; i++ {
		if data[i] != 0 {
			continue
		}
		data[i] = i
		if i > n/i {
			continue
		}
		for j := i * i; j <= n; j += i {
			if data[j] == 0 {
				data[j] = i
			}
		}
	}

	factors := func(n int) map[int]int {
		ret := make(map[int]int)
		for n > 1 {
			ret[data[n]]++
			n /= data[n]
		}
		return ret
	}

	fmt.Scan(&n)
	min1 := make(map[int]int)
	min2 := make(map[int]int)
	cnt := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		for k, v := range factors(a) {
			m1, ok1 := min1[k]
			m2, ok2 := min2[k]
			if !ok1 || m1 > v {
				min2[k] = min1[k]
				min1[k] = v
			} else if !ok2 || m2 > v {
				min2[k] = v
			}
			cnt[k]++
		}
	}

	var pow func(n, p int) int64
	pow = func(n, p int) int64 {
		if p == 0 {
			return 1
		}
		ret := pow(n, p/2)
		ret = ret * ret
		if p%2 == 1 {
			ret *= int64(n)
		}
		return ret
	}

	ans := int64(1)
	for k, v := range cnt {
		if v < n-1 {
			continue
		}
		ans *= pow(k, min2[k])
	}
	fmt.Println(ans)
}

/*
URL:
https://codeforces.com/problemset/problem/1349/A
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int64

	P [200000 + 5][]int64
)

func main() {
	n = ReadInt()
	A = ReadInt64Slice(n)

	for i := 0; i < n; i++ {
		if A[i] == 1 {
			continue
		}

		memo := TrialDivision(A[i])
		for k, v := range memo {
			P[k] = append(P[k], v)
		}
	}

	ans := int64(1)
	for i := 0; i <= 200000; i++ {
		if len(P[i]) >= n-1 {
			sort.Slice(P[i], func(j, k int) bool { return P[i][j] < P[i][k] })

			e := P[i][1]
			ans *= PowInt(int64(i), e)
		}
	}
	fmt.Println(ans)
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int64) int64 {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int64) map[int64]int64 {
	var i, exp int64
	p := map[int64]int64{}

	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	for i = 2; i*i <= n; i++ {
		exp = 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}


package main
import (
	"fmt"
)
func main() {
	var n int
	b:=0
	awe:=0
	fmt.Scan(&n)
	in:=make([]int,n)
	for i:=0;i<n;i++{
		fmt.Scan(&in[i])
		if i==0{b = in[i]}
		if in[i]>b{
			b = in[i]
			awe++
		}
		if b>in[i]{
			if in[0]>in[i]{
				in[0] = in[i]
				awe++
			}
		}
	}
	fmt.Println(awe)
}

package main

import (
  "fmt"
)

func main() {
  var (
    n int
    max  = -1
    min = 1001
    current int
    answer = 0
  )
  fmt.Scanln(&n)
  fmt.Scan(&max)
  min = max
  for i:=1; i < n; i++ {
    fmt.Scan(&current)
    if current > max{
      answer++
      max = current
    } else {
      if current < min {
        answer++
        min = current
      }
    }
  }
  fmt.Println(answer)
}

package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	_ = scanner.Text()

	scanner.Scan()
	scores := scanner.Text()

	var scoresList []int

	for _, scoreString := range strings.Split(scores, " ") {
		score, err := strconv.Atoi(scoreString)
		if err != nil {
			log.Fatal(err)
		}
		scoresList = append(scoresList, score)
	}

	var (
		counter int
		min     int
		max     int
	)

	min, max = scoresList[0], scoresList[0]

	for i := 1; i < len(scoresList); i++ {
		if scoresList[i] > max {
			counter++
			max = scoresList[i]
		} else if scoresList[i] < min {
			counter++
			min = scoresList[i]
		}
	}

	fmt.Println(counter)
}

package main

import "fmt"

func main() {
	var n, v, min, max int
	fmt.Scan(&n)

	amazing := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&v)
		if i == 0 {
			min, max = v, v
		} else {
			if v > max {
				amazing += 1
				max = v
			}
			if v < min {
				amazing += 1
				min = v
			}
		}
	}

	fmt.Print(amazing)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

var n int

func main() {
	fmt.Fscan(reader, &n)
	var ans, min, max int
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(reader, &a)
		if i == 0 {
			min, max = a, a
		}
		if a < min {
			min = a
			ans++
		}
		if a > max {
			max = a
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, m, l, c, t uint16
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:=uint16(0); i < n - 1; i++{
		fmt.Fscanf(in, "%d ", &t)
		if i == 0{
			m = t
			l = t
		}
		if i > 0{
			if t > m{
				m = t
				c++
			}else if t < l{
				l = t
				c++
			}
		}

	}
	fmt.Fscanf(in, "%d\n", &t)
	if t > m{
		m = t
		c++
	}else if t < l{
		l = t
		c++
	}
	if n < 2{
		fmt.Println(0)
	}else{
		fmt.Println(c)
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	a := make([]int, n)
	for i := range a {
		a[i] = readi()
	}
	var ans int
	maxv := a[0]
	minv := a[0]
	for i := range a {
		if maxv < a[i] {
			ans++
			maxv = a[i]
		}
		if a[i] < minv {
			ans++
			minv = a[i]
		}
	}
	println(ans)
}

// 155A-arnold
package main

import (
	"fmt"
)

func main() {
	var n, poin int
	fmt.Scan(&n)
	fmt.Scan(&poin)
	a := 0
	min := poin
	max := poin
	for x := n; x >= 0; x-- {
		fmt.Scan(&poin)
		if poin < min {
			min = poin
			a++
		}
		if poin > max {
			max = poin
			a++
		}
	}
	fmt.Print(a)
}

package main

import (
    "fmt"
    "bufio"
    "os"
    "strconv"
    )

func main() {
    var n int
    fmt.Scan(&n)

    bs := bufio.NewScanner(os.Stdin)
    bs.Split(bufio.ScanWords)

    bs.Scan()
    num, _ := strconv.Atoi(bs.Text())

    min := num
    max := num
    result := 0
    for i := 1; i < n; i++ {
        bs.Scan()
        num, _ = strconv.Atoi(bs.Text())
        if min > num {
            min = num
            result++
        }
        if max < num {
            max = num
            result++
        }
    }

    fmt.Println(result)
}

package main
import (
    "fmt"
)

func main() {
    var num int
    fmt.Scan(&num)

    //setup
    var first int
    fmt.Scan(&first)
    max := first
    min := first
    counter := 0

    for i := 1; i < num; i++ {
        var temp int
        fmt.Scan(&temp)
        if temp > max {
            max = temp
            counter++
        }
        if temp < min {
            min = temp
            counter ++
        }
    }

    fmt.Println(counter)
}

// 155A-Mic
package main

import (
    "fmt"
)

func main() {
    var max, min, input, n, cou int
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&input)
        if i == 0 {
            min = input
            max = input
        }
        if input < min {
            cou++
            min = input
        }
        if input > max {
            cou++
            max = input
        }
    }
    fmt.Println(cou)
}

package main
import (
    "fmt"
)
func main() {
    var temp,n,max,min,counter int = 0,0,0,0,0
    fmt.Scan(&n)
    fmt.Scan(&temp)
    min,max= temp,temp
    for i:=1;i<n;i++ {
        fmt.Scan(&temp)
        if temp>max {
            max=temp
            counter++
        }
        if temp<min {
            min=temp
            counter++
        }
    }
    fmt.Println(counter)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d\n", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	r := 0
	for i := 1; i < n; i++ {
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

// https://codeforces.com/problemset/problem/155/A
// A. I_love_%username%
// time limit per test
// 2 seconds
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him.

// One day Vasya decided to collect the results of all contests where his favorite coder participated and track the progress of his coolness. For each contest where this coder participated, he wrote out a single non-negative number — the number of points his favorite coder earned in the contest. Vasya wrote out the points for the contest in the order, in which the contests run (naturally, no two contests ran simultaneously).

// Vasya considers a coder's performance in a contest amazing in two situations: he can break either his best or his worst performance record. First, it is amazing if during the contest the coder earns strictly more points that he earned on each past contest. Second, it is amazing if during the contest the coder earns strictly less points that he earned on each past contest. A coder's first contest isn't considered amazing. Now he wants to count the number of amazing performances the coder had throughout his whole history of participating in contests. But the list of earned points turned out long and Vasya can't code... That's why he asks you to help him.
// Input

// The first line contains the single integer n (1 ≤ n ≤ 1000) — the number of contests where the coder participated.

// The next line contains n space-separated non-negative integer numbers — they are the points which the coder has earned. The points are given in the chronological order. All points do not exceed 10000.
// Output

// Print the single number — the number of amazing performances the coder has had during his whole history of participating in the contests.

func main() {
	bufStdin := bufio.NewReader(os.Stdin)

	var n int
	_, _ = fmt.Fscan(bufStdin, &n)

	scores := make([]int, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscan(bufStdin, &scores[i])
	}

	bestScore := scores[0]
	worstScore := scores[0]
	var nAmazingPerformances int
	for i := 1; i < n; i++ {
		v := scores[i]
		if v > bestScore {
			bestScore = v
			nAmazingPerformances++
		} else if v < worstScore {
			worstScore = v
			nAmazingPerformances++
		}
	}

	fmt.Print(nAmazingPerformances)
}

package main

import "fmt"

func main() {
    var n,a int
    fmt.Scan(&n)
    fmt.Scan(&a)
    min, max, ans := a, a, 0
    for i := 1; i < n; i++ {
        fmt.Scan(&a)
        if (min > a) { min = a; ans++ }
        if (max < a) { max = a; ans++ }
    }
    fmt.Println(ans)
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/155/A
// комментарии к решению
// Т.к. чисел не много и ограничение сверху целых 2 сек, то используем fmt.Scan
func taskSolution(a []int) (ans int) {
	min := a[0]
	max := a[0]
	for i := 1; i < len(a); i += 1 {
		if min > a[i] {
			min, ans = a[i], ans+1
		} else if max < a[i] {
			max, ans = a[i], ans+1
		}
	}
	return ans
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	a := []int{}
	for i := 0; i < n; i += 1 {
		var ai int
		if _, err := fmt.Scan(&ai); err != nil {
			panic(err)
		}
		a = append(a, ai)
	}

	fmt.Println(taskSolution(a))
}

package main

import (
	"fmt"
)

func main() {
	var n, min, max, amazing int
	fmt.Scan(&n, &min)
	max = min
	for i := 1; i < n; i++ {
		var x int
		fmt.Scan(&x)
		if x < min {
			min = x
			amazing++
		} else if x > max {
			max = x
			amazing++
		}
	}
	fmt.Println(amazing)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, s int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	fmt.Fscan(in, &s)
	max, min := s, s
	count := 0
	for i := 1; i < n; i++ {
		fmt.Fscan(in, &s)
		if s < min {
			count++
			min = s
		}
		if s > max {
			count++
			max = s
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	var n, bestScore int
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%d", &bestScore)
	worstScore := bestScore
	amazing := 0
	for i := 1; i < n; i++ {
		var nextScore int
		fmt.Scanf("%d", &nextScore)
		if nextScore > bestScore {
			amazing++
			bestScore = nextScore
		}
		if nextScore < worstScore {
			amazing++
			worstScore = nextScore
		}
	}
	fmt.Println(amazing)
}

package main

import(
    "fmt"
)

func main(){
    var(
        n,t1,t2,h,l int
    )
    fmt.Scan(&n)
    a:=make([]int,n)
    m:=make(map[int]int)
    for i:=0;i<n;i++{
        fmt.Scan(&a[i])
    }
    t1,t2,h,l=0,0,a[0],a[0]
    m[a[0]]=1
    if n>1{
        for i:=1;i<n;i++{
            _,ok:=m[a[i]]
            if a[i]>h && ok==false {
                h=a[i]
                t1++
                m[a[i]]=1
            }else{
                if l>a[i] && ok==false{
                    l=a[i]
                    m[a[i]]=1
                    t2++
                }
            }
        }
        if l!=a[0]{
            fmt.Println(t1+t2)
        }else{
            fmt.Println(t1)
        }
    }else{
        fmt.Println(t1)
    }
}

package main

import (
"fmt"
)

func main() {
	var n,x int64
	fmt.Scan(&n)
	var mini,maxi int64
	fmt.Scan(&mini)
	maxi = mini
	amaze := 0
	n--
	for ; n>0; n-- {
		fmt.Scan(&x)
		if x>maxi || x<mini {
			amaze++
		}
		if x > maxi {
			maxi = x
		}
		if x < mini {
			mini = x
		}
	}
	fmt.Printf("%d\n",amaze)
}

package main

import ("fmt")

// func calculate(y,d int32){
// 	answer := y%d
// 	if answer==0{
// 		fmt.Println("YES")
// 	}else{
// 		fmt.Println("NO")
// 	}
// }

func main(){
	var t int
	fmt.Scanln(&t)
	var first int
	fmt.Scan(&first)
	var max int = first
	var min int = first
	count :=0
	for i:=1;i<t;i++{
		var next int
		fmt.Scan(&next)
		if next>max{
			count++
			max = next
		}
		if next<min{
			count++
			min = next
		}

	}
	fmt.Println(count)
}

package main
import "fmt"

func main()  {
	var input,high,low,n int
//	fmt.Println("Enter the number of values:")
	fmt.Scan(&n)
	var count int
	for i := 0; i < n; i++ {
		//fmt.Print("enter the value of input:")
		fmt.Scan(&input)
	   if i==0 {
		   high=input
		   low=input
		   continue
	   }
	   if input>high {
		   high=input
		   count++

	   }
	   if input<low {
		   low=input
		   count++
	   }
	}

	fmt.Println(count)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n int
	fmt.Scanf("%d \n", &n)

	reader := bufio.NewReader(os.Stdin)
	ss, _ := reader.ReadString('\n')
	list := strings.Split(strings.TrimRight(ss, "\r\n"), " ")

	max, _ := strconv.ParseUint(list[0], 10, 64)
	min, _ := strconv.ParseUint(list[0], 10, 64)
	count := 0
	for i := 1; i < n; i++ {
		t, _ := strconv.ParseUint(list[i], 10, 64)
		if t > max {
			max = t
			count++
		}
		if t < min {
			min = t
			count++
		}
	}
	fmt.Print(count)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}

	minm := arr[0]
	maxm := arr[0]
	count := 0

	for i := 1; i < n; i++ {
		if arr[i] < minm {
			minm = arr[i]
			count++;
		}else if arr[i] > maxm {
			maxm = arr[i]
			count++;
		}
	}
	fmt.Println(count)
}

package main

import "bufio"
import "os"
import "fmt"

func Read(s *bufio.Reader) string {
    line, _ := s.ReadString('\n')
    return line
}

func Write(s *bufio.Writer, a ...interface{}) {
    fmt.Fprintln(s, a...)
    s.Flush()
}

func main() {
    reader := bufio.NewReader(os.Stdin)

    var n int
    fmt.Sscanln(Read(reader), &n)

    a := make([]int, n)

    for i := 0; i < n - 1; i++ {
        line, _ := reader.ReadString(' ')
        fmt.Sscanln(line, &a[i])
    }

    fmt.Sscanln(Read(reader), &a[n - 1])
    max, min := a[0], a[0]
    var counter int = 0

    for i := 1; i < n; i++ {
        if a[i] < min {
            min = a[i]
            counter++
        }

        if a[i] > max {
            max = a[i]
            counter++
        }
    }

    writer := bufio.NewWriter(os.Stdout)

    Write(writer, counter)
}

package main

import(
    "fmt"
)

func main(){
    var(
        n,temp int
    )
    fmt.Scan(&n)
    arr:=make([]int,n)
    for i:=0;i<n;i++{
        fmt.Scan(&arr[i])
    }
    temp=0
    for i:=1;i<n;i++{
        if arr[i]>arr[i-1]{
            temp++
        }
    }
    fmt.Println(temp)
}

package main

import(
    "fmt"
)

func main(){
    var(
        n,t1,h,l int
    )
    fmt.Scan(&n)
    a:=make([]int,n)
    m:=make(map[int]int)
    for i:=0;i<n;i++{
        fmt.Scan(&a[i])
    }
    t1,h,l=0,a[0],a[0]
    m[a[0]]=1
    if n>1{
        for i:=1;i<n;i++{
            if a[i]>h{
                h=a[i]
                t1++
            }else{
                if l>a[i]{
                    l=a[i]
                }
            }
        }
        if l!=a[0]{
            fmt.Println(t1+1)
        }else{
            fmt.Println(t1)
        }
    }else{
        fmt.Println(t1)
    }
}

package main
import (
	"fmt"
)
func main() {
	var n int
	b:=0
	awe:=0
	fmt.Scan(&n)
	in:=make([]int,n)
	for i:=0;i<n;i++{
		fmt.Scan(&in[i])
		if in[i]>b{
			b = in[i]
			awe+=1
		}
		if b>in[i]{
			if in[0]>in[i]{
				in[0] = in[i]
				awe+=1
			}
		}
	}
	fmt.Println(awe-1)
}

package main
import (
	"fmt"
)
func main() {
	var n int
	b:=0
	awe:=0
	fmt.Scan(&n)
	in:=make([]int,n)
	for i:=0;i<n;i++{
		fmt.Scan(&in[i])
		if in[i]>b{
			b = in[i]
			awe+=1

		}else{
			if b>in[i]{
				if in[0]>in[i]{
					in[0] = in[i]
					awe+=1
				}
			}
		}
	}
	fmt.Println(awe-1)
}

package main

import (
	"bufio"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	_ = scanner.Text()

	scanner.Scan()
	scores := scanner.Text()

	var scoresList []int

	for _, scoreString := range strings.Split(scores, " ") {
		score, err := strconv.Atoi(scoreString)
		if err != nil {
			log.Fatal(err)
		}
		scoresList = append(scoresList, score)
	}

	var (
		counter int
		min     int
		max     int
	)

	min, max = scoresList[0], scoresList[0]

	for i := 1; i < len(scoresList); i++ {
		if scoresList[i] > max {
			counter++
			max = scoresList[i]
		} else if scoresList[i] < min {
			counter++
			min = scoresList[i]
		}
	}

	print(counter)
}

package main

import (
	"bufio"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	_ = scanner.Text()

	scanner.Scan()
	scores := scanner.Text()

	var scoresList []int

	for _, scoreString := range strings.Split(scores, " ") {
		score, err := strconv.Atoi(scoreString)
		if err != nil {
			log.Fatal(err)
		}
		scoresList = append(scoresList, score)
	}

	var (
		counter int
		min     int
		max     int
	)

	min, max = scoresList[0], scoresList[0]

	for i := 1; i < len(scoresList); i++ {
		if scoresList[i] > max {
			counter++
			max = scoresList[i]
		} else if scoresList[i] < min {
			counter++
			min = scoresList[i]
		}
	}

	log.Println(counter)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, m, l, c, t uint16
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:=uint16(0); i < n - 1; i++{
		fmt.Fscanf(in, "%d ", &t)
		if i == 0{
			m = t
			l = t
		}
		if i > 0{
			if t > m{
				m = t
				c++
			}else if t < l{
				l = t
				c++
			}
		}

	}
	fmt.Fscanf(in, "%d\n", &t)
	if t > m{
		m = t
		c++
	}else if t < l{
		l = t
		c++
	}
	fmt.Println(c)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, m, l, c, t uint16
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d\n", &n)
	for i:=uint16(0); i < n - 1; i++{
		fmt.Fscanf(in, "%d ", &t)
		if i == 0{
			m = t
			l = t
		}
		if i > 0{
			if t > m{
				m = t
				c++
			}else if t < l{
				l = t
				c++
			}
		}

	}
	fmt.Fscanf(in, "%d\n", &t)
	if t > m{
		m = t
		c++
	}else if t < l{
		l = t
		c++
	}
	if n < 3{
		fmt.Println(0)
	}else{
		fmt.Println(c)
	}
}

// 155A-arnold
package main

import (
    "fmt"
)

func main() {
    var n, poin int
    fmt.Scan(n)
    fmt.Scan(poin)
    a := 0
    min := poin
    max := poin
    for x := n; x > 0; x-- {
        fmt.Scan(poin)
        if poin < min {
            min = poin
            a++
        }
        if poin > max {
            max = poin
            a++
        }
    }
    fmt.Print(a)
}

// 155A-arnold
package main

import (
    "fmt"
)

func main() {
    var n, poin int
    fmt.Scan(n)
    fmt.Scan(poin)
    a := 0
    min := poin
    max := poin
    for a = n; a > 0; a-- {
        fmt.Scan(poin)
        if poin < min {
            min = poin
            a++
        }
        if poin > max {
            max = poin
            a++
        }
    }
    fmt.Print(a)
}

// 155A-arnold
package main

import (
	"fmt"
)

func main() {
	var n, poin int
	fmt.Scan(&n)
	fmt.Scan(&poin)
	a := 0
	var min, max int
	for x := n; x >= 0; x-- {
		fmt.Scan(poin)
		if poin < min {
			min = poin
			a++
		}
		if poin > max {
			max = poin
			a++
		}
	}
	fmt.Print(a)
}

// 155A-arnold
package main

import (
	"fmt"
)

func main() {
	var n, poin int
	fmt.Scan(n)
	fmt.Scan(poin)
	a := 0
	var min, max int
	for x := n; x > 0; x-- {
		fmt.Scan(poin)
		if poin < min {
			min = poin
			a++
		}
		if poin > max {
			max = poin
			a++
		}
	}
	fmt.Print(a)
}

// 155A-arnold
package main

import (
    "fmt"
)

func main() {
    var n, poin int
    fmt.Scanln(n)
    fmt.Scanln(poin)
    a := 0
    min := poin
    max := poin
    for x := n; x > 0; x-- {
        fmt.Scan(poin)
        if poin < min {
            min = poin
            a++
        }
        if poin > max {
            max = poin
            a++
        }
    }
    fmt.Print(a)
}

// 155A-arnold
package main

import (
	"fmt"
)

func main() {
	var n, poin int
	fmt.Scan(&n)
	fmt.Scan(&poin)
	a := 0
	min := poin
	max := poin
	for x := n; x >= 0; x-- {
		fmt.Scan(poin)
		if poin < min {
			min = poin
			a++
		}
		if poin > max {
			max = poin
			a++
		}
	}
	fmt.Print(a)
}

package main
import (
    "fmt"
)

func main() {
    var num int
    fmt.Scan(&num)

    max := 0
    min := 10000
    counter := 0

    for i := 0; i < num; i++ {
        var temp int
        fmt.Scan(&temp)
        if temp > max {
            max = temp
            counter++
        }
        if temp < min {
            min = temp
            counter ++
        }
    }

    fmt.Println(counter-2)
}

// 155A-Mic
package main

import (
    "fmt"
)

func main() {
    var max, min, input, n, cou int
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&input)
        if i == 0 {
            min = input
            max = input
        }
        if input < min {
            cou++
            min = input
        }
        if input > max {
            cou++
            max = input
        }

    }
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d", &n)
	var x int
	fmt.Scanf("%d", &x)
	min, max := x, x
	r := 0
	for i := 1; i < n; i++ {
		fmt.Scanf("%d", &x)
		if x < min {
			r = r + 1
			min = x
		}
		if x > max {
			r = r + 1
			max = x
		}
	}
	fmt.Println(r)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	r := 0
	for i := 1; i < n; i++ {
                if n == 10 {
                        fmt.Println(a[i])
                }
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	r := 0
	for i := 1; i < n; i++ {
                if n == 10 {
                        fmt.Println(n)
                }
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d\n", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	if n == 10 {
		fmt.Println(a[0])
	}
	r := 0
	for i := 1; i < n; i++ {
                if n == 10 {
                        fmt.Println(a[i])
                }
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	if n == 10 {
		fmt.Println(a[0])
	}
	r := 0
	for i := 1; i < n; i++ {
                if n == 10 {
                        fmt.Println(a[i])
                }
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	r := 0
	for i := 1; i < n; i++ {
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}

package main
import "fmt"

func main(){
	var n int
	fmt.Scanf("%d\n", &n)
	var a [1005]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	min, max := a[0], a[0]
	fmt.Println(a[0])
	r := 0
	for i := 1; i < n; i++ {
                if n == 10 {
                        fmt.Println(a[i])
                }
		if a[i] < min {
			r = r + 1
			min = a[i]
		}
		if a[i] > max {
			r = r + 1
			max = a[i]
		}
	}
	fmt.Println(r)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	n   int
	p   int
	st  string
	pos []byte
)

func main() {

	defer out.Flush()
	in.Split(bufio.ScanWords)

	fmt.Scanf("%d %d", &n, &p)
	//readInt(&n, &p)
	p--

	//readString(&st)
	fmt.Scan(&st)

	pos = []byte(st)
	a := make([]int, n)
	b := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = get(i, n-i-1)
	}

	if p >= n/2 {
		p -= (n + 1) / 2
		st = st[(n+1)/2:]
		b = a[(n+1)/2:]
	} else {
		st = st[:n/2]
		b = a[:n/2]
	}

	/*	for _, value := range b {
			write(value)
		}
		out.WriteString("\n")
	*/
	ans := 0
	ln := len(b)

	left := 0
	right := ln - 1

	for (left < ln) && (b[left] == 0) {
		left++
	}
	for (right >= 0) && (b[right] == 0) {
		right--
	}
	//write(p, left, right)
	//out.WriteString("\n")

	if right < left {
		ans = 0
	} else if (left > p) || (right < p) {
		ans = min(abs(left-p), abs(p-right)) + (right - left)
	} else if abs(left-p) < abs(right-p) {
		ans = (right - left) + (p - left)
	} else {
		ans = (right - left) + (right - p)
	}

	sum := 0
	for _, value := range b {
		sum += value
	}

	write(sum + ans)

	//out.WriteString(st + "\n")
}

func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func get(x int, y int) int {
	if pos[x] > pos[y] {
		return min(int(pos[x]-pos[y]), int(pos[y]-pos[x]+26))
	} else {
		return min(int(pos[y]-pos[x]), int(pos[x]-pos[y]+26))
	}
}

func write(num ...int) {
	for _, value := range num {
		str := strconv.Itoa(value)
		out.WriteString(str + " ")
	}
	//out.WriteString("\n")
}
func readInt(num ...*int) {

	for _, value := range num {
		in.Scan()
		*value, _ = strconv.Atoi(in.Text())
	}
}

func readString(st *string) {
	in.Scan()
	*st = in.Text()
}

package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
)

var testCases = []struct {
	s           string
	p           int
	expectedRet int
}{
	{"aaaabbbb", 3, 8},
	{"aabbbbaaaaccccaa", 4, 8},
	{"aabbbbaaaaccccaa", 1, 9},
	{"a", 1, 0},
	{"ab", 1, 1},
	{"abc", 2, 3},
	{"aeabcaez", 3, 6},
	{"abcdefdcba", 6, 1},
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func solve(s string, p int) int {
	p-- // To zero index base

	// Transform p to be in the first half if it's not, this does not change
	// the problem.
	if p >= len(s)/2 {
		p = len(s) - 1 - p
	}

	a := 0
	b := (len(s) - 1) / 2
	for ; b >= 0 && s[b] == s[len(s)-1-b]; b-- {
	}
	if b < 0 {
		// Already a palindrome
		return 0
	}
	for ; a < b && s[a] == s[len(s)-1-a]; a++ {
	}

	ret := 0
	// Calculate number of moves needed to change the letters.  Has to be
	// made no matter what.
	for i := a; i <= b; i++ {
		c1 := s[i]
		c2 := s[len(s)-1-i]
		ret += min((26+int(c1)-int(c2))%26, (26+int(c2)-int(c1))%26)
	}

	if p < a {
		ret += a - p
		p = a
	}
	if p > b {
		ret += p - b
		p = b
	}

	ret += b - a + min(b-p, p-a)
	return ret
}

func main() {
	o := bufio.NewReader(os.Stdin)

	for _, t := range testCases {
		var ret = solve(t.s, t.p)
	  if ret != t.expectedRet {
			log.Fatalf("Wrong ret for (%v, %v): expected %v, got %v", t.s, t.p, t.expectedRet, ret)
	  }
	}

	var n, p int
	var s string
	fmt.Fscanf(o, "%d %d %s ", &n, &p, &s)
	if len(s) != n {
		log.Fatalf("%d != %d", len(s), n)
	}

	fmt.Printf("%d\n", solve(s, p))
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func Sol486C(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n, p int
	var s string
	Fscan(in, &n, &p, &s)
	n2 := n / 2
	p--
	if p >= n2 {
		p = n - 1 - p
	}

	pos := []int{}
	ans := 0
	for i := 0; i < n2; i++ {
		if s[i] != s[n-1-i] {
			pos = append(pos, i)
			d := (s[i] - s[n-1-i] + 26) % 26
			if d > 13 {
				d = 26 - d
			}
			ans += int(d)
		}
	}
	if ans == 0 {
		Fprint(out, 0)
		return
	}
	dl, dr := p-pos[0], pos[len(pos)-1]-p
	if dl <= 0 {
		ans += dr
	} else if dr <= 0 {
		ans += dl
	} else {
		if dl <= dr {
			ans += 2*dl + dr
		} else {
			ans += 2*dr + dl
		}
	}
	Fprintln(out, ans)
}

func main() {
	Sol486C(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"os"
	"strconv"
)

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	n   int
	p   int
	st  string
	pos []byte
)

func main() {

	defer out.Flush()
	in.Split(bufio.ScanWords)

	readInt(&n, &p)
	p--

	readString(&st)

	pos = []byte(st)
	a := make([]int, n)
	b := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = get(i, n-i-1)
	}
	/*
		for _, value := range a {
			write(value)
		}
		out.WriteString("\n")

	*/
	if p > (n / 2) {
		p -= (n + 1) / 2
		st = st[(n+1)/2:]
		b = a[(n+1)/2:]
	} else {
		st = st[:n/2]
		b = a[:n/2]
	}

	ans := 0
	ln := len(b)

	if (ln-1)+(ln-p-1) > ln+p-1 {
		ans = ln + p - 1
	} else {
		ans = (ln - 1) + (ln - p - 1)
	}

	sum := 0
	for _, value := range b {
		sum += value
	}

	write(sum + ans)

	//out.WriteString(st + "\n")
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func get(x int, y int) int {
	if pos[x] > pos[y] {
		return min(int(pos[x]-pos[y]), int(pos[y]-pos[x]+26))
	} else {
		return min(int(pos[y]-pos[x]), int(pos[x]-pos[y]+26))
	}
}

func write(num ...int) {
	for _, value := range num {
		str := strconv.Itoa(value)
		out.WriteString(str + " ")
	}
	//out.WriteString("\n")
}
func readInt(num ...*int) {

	for _, value := range num {
		in.Scan()
		*value, _ = strconv.Atoi(in.Text())
	}
}

func readString(st *string) {
	in.Scan()
	*st = in.Text()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	n   int
	p   int
	st  string
	pos []byte
)

func main() {

	defer out.Flush()
	in.Split(bufio.ScanWords)

	fmt.Scanf("%d %d", &n, &p)
	//readInt(&n, &p)
	p--

	//readString(&st)
	fmt.Scan(&st)

	pos = []byte(st)
	a := make([]int, n)
	b := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = get(i, n-i-1)
	}

	if p > (n / 2) {
		p -= (n + 1) / 2
		st = st[(n+1)/2:]
		b = a[(n+1)/2:]
	} else {
		st = st[:n/2]
		b = a[:n/2]
	}

	/*
		for _, value := range b {
			write(value)
		}
		out.WriteString("\n")
	*/
	ans := 0
	ln := len(b)

	left := 0
	right := ln - 1

	for (left < ln) && (b[left] == 0) {
		left++
	}
	for (right >= 0) && (b[right] == 0) {
		right--
	}
	//write(p, left, right)
	//out.WriteString("\n")

	if right < left {
		ans = 0
	} else if (left > p) || (right < p) {
		ans = min(abs(left-p), abs(p-right)) + (right - left)
	} else if abs(left-p) < abs(right-p) {
		ans = (right - left) + (p - left)
	} else {
		ans = (right - left) + (right - p)
	}

	sum := 0
	for _, value := range b {
		sum += value
	}

	write(sum + ans)

	//out.WriteString(st + "\n")
}

func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func get(x int, y int) int {
	if pos[x] > pos[y] {
		return min(int(pos[x]-pos[y]), int(pos[y]-pos[x]+26))
	} else {
		return min(int(pos[y]-pos[x]), int(pos[x]-pos[y]+26))
	}
}

func write(num ...int) {
	for _, value := range num {
		str := strconv.Itoa(value)
		out.WriteString(str + " ")
	}
	//out.WriteString("\n")
}
func readInt(num ...*int) {

	for _, value := range num {
		in.Scan()
		*value, _ = strconv.Atoi(in.Text())
	}
}

func readString(st *string) {
	in.Scan()
	*st = in.Text()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	n   int
	p   int
	st  string
	pos []byte
)

func main() {

	defer out.Flush()
	in.Split(bufio.ScanWords)

	fmt.Scanf("%d %d", &n, &p)
	//readInt(&n, &p)
	p--

	//readString(&st)
	fmt.Scan(&st)

	pos = []byte(st)
	a := make([]int, n)
	b := make([]int, n)

	for i := 0; i < n; i++ {
		a[i] = get(i, n-i-1)
	}

	if p > (n / 2) {
		p -= (n + 1) / 2
		st = st[(n+1)/2:]
		b = a[(n+1)/2:]
	} else {
		st = st[:n/2]
		b = a[:n/2]
	}

	/*
		for _, value := range b {
			write(value)
		}
		out.WriteString("\n")
	*/
	ans := 0
	ln := len(b)

	left := 0
	right := ln - 1

	for (left < ln) && (b[left] == 0) {
		left++
	}
	for (right >= 0) && (b[right] == 0) {
		right--
	}

	//write(p, left, right)
	//out.WriteString("\n")

	if (left > p) || (right < p) {
		ans = min(abs(left-p), abs(p-right)) + (right - left)
	} else if abs(left-p) < abs(right-p) {
		ans = (right - left) + (p - left)
	} else {
		ans = (right - left) + (right - p)
	}

	sum := 0
	for _, value := range b {
		sum += value
	}

	write(sum + ans)

	//out.WriteString(st + "\n")
}

func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func get(x int, y int) int {
	if pos[x] > pos[y] {
		return min(int(pos[x]-pos[y]), int(pos[y]-pos[x]+26))
	} else {
		return min(int(pos[y]-pos[x]), int(pos[x]-pos[y]+26))
	}
}

func write(num ...int) {
	for _, value := range num {
		str := strconv.Itoa(value)
		out.WriteString(str + " ")
	}
	//out.WriteString("\n")
}
func readInt(num ...*int) {

	for _, value := range num {
		in.Scan()
		*value, _ = strconv.Atoi(in.Text())
	}
}

func readString(st *string) {
	in.Scan()
	*st = in.Text()
}

package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
)

var testCases = []struct {
	s           string
	p           int
	expectedRet int
}{
	//{"aaaabbbb", 3, 8},
	// {"aabbbbaaaaccccaa", 4, 8},
	// {"aabbbbaaaaccccaa", 1, 9},
	// {"a", 1, 0},
	// {"ab", 1, 1},
	// {"abc", 2, 3},
	{"aeabcaez", 3, 6},
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func solve(s string, p int) int {
	p-- // To zero index base

	// Transform p to be in the first half if it's not, this does not change
	// the problem.
	if p > len(s)/2 {
		p = len(s) - 1 - p
	}

	a := 0
	b := (len(s) - 1) / 2
	for ; b >= 0 && s[b] == s[len(s)-1-b]; b-- {
	}
	if b < 0 {
		// Already a palindrome
		return 0
	}
	for ; a < b && s[a] == s[len(s)-1-a]; a++ {
	}

	ret := 0
	// Calculate number of moves needed to change the letters.  Has to be
	// made no matter what.
	for i := a; i <= b; i++ {
		c1 := s[i]
		c2 := s[len(s)-1-i]
		ret += min((26+int(c1)-int(c2))%26, (26+int(c2)-int(c1))%26)
	}

	if p < a {
		ret += a - p
		p = a
	}
	if p > b {
		ret += p - b
		p = b
	}

	ret += b - a + min(b-p, p-a)
	return ret
}

func main() {
	o := bufio.NewReader(os.Stdin)

	for _, t := range testCases {
		var ret = solve(t.s, t.p)
	  if ret != t.expectedRet {
			log.Fatalf("Wrong ret for (%v, %v): expected %v, got %v", t.s, t.p, t.expectedRet, ret)
	  }
	}

	var n, p int
	var s string
	fmt.Fscanf(o, "%d %d %s ", &n, &p, &s)
	if len(s) != n {
		log.Fatalf("%d != %d", len(s), n)
	}

	fmt.Printf("%d\n", solve(s, p))
}

package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
)

var testCases = []struct {
	s           string
	p           int
	expectedRet int
}{
	{"aaaabbbb", 3, 8},
	{"aabbbbaaaaccccaa", 4, 8},
	{"aabbbbaaaaccccaa", 1, 9},
	{"a", 1, 0},
	{"ab", 1, 1},
	{"abc", 2, 3},
}

func min(x int, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

func solve(s string, p int) int {
	p-- // To zero index base

	// Transform p to be in the first half if it's not, this does not change
	// the problem.
	if p > len(s)/2 {
		p = len(s) - 1 - p
	}

	a := 0
	b := (len(s) - 1) / 2
	for ; b >= 0 && s[b] == s[len(s)-1-b]; b-- {
	}
	if b < 0 {
		// Already a palindrome
		return 0
	}
	for ; a < b && s[a] == s[len(s)-1-a]; a++ {
	}

	ret := 0
	// Calculate number of moves needed to change the letters.  Has to be
	// made no matter what.
	for i := a; i <= b; i++ {
		c1 := s[i]
		c2 := s[len(s)-1-i]
		ret += min((26+int(c1-c2))%26, (26+int(c2-c1))%26)
	}

	if p < a {
		ret += a - p
		p = a
	}
	if p > b {
		ret += p - b
		p = b
	}

	ret += b - a + min(b-p, p-a)
	return ret
}

func main() {
	o := bufio.NewReader(os.Stdin)

	for _, t := range testCases {
		var ret = solve(t.s, t.p)
	  if ret != t.expectedRet {
			log.Fatalf("Wrong ret for (%v, %v): expected %v, got %v", t.s, t.p, t.expectedRet, ret)
	  }
	}

	var n, p int
	var s string
	fmt.Fscanf(o, "%d %d %s ", &n, &p, &s)
	if len(s) != n {
		log.Fatalf("%d != %d", len(s), n)
	}

	fmt.Printf("%d\n", solve(s, p))
}