package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T, n, x int
	Fscan(r, &T)
	for t := 0; t < T; t++ {
		Fscan(r, &n)
		mp := make(map[int]int)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			mp[x]++
		}
		for i := 1; i <= n; i++ {
			if i <= len(mp) {
				Fprintf(w, "%d ", len(mp))
			} else {
				Fprintf(w, "%d ", i)
			}
		}
		Fprintln(w)
	}

}

// LUOGU_RID: 91700269
package main

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

func main() {
	// 快速输入输出
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	var t, n, i int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var a int
		fmt.Fscan(f, &n)
		m := map[int]int{}
		for i = 0; i < n; i++ {
			fmt.Fscan(f, &a)
			m[a]++
		}
		l := len(m)
		for i = 1; i <= l; i++ {
			fmt.Fprint(w, l, " ")
		}
		for i = l + 1; i <= n; i++ {
			fmt.Fprint(w, i, " ")
		}
		fmt.Fprintln(w, "") // 换行
	}
	w.Flush()
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		o, p := map[int]int{}, 0
		for j := 0; j < n; j++ {
			fmt.Fscan(f, &p)
			o[p]++
		}
		l := len(o)
		for j := 0; j < l; j++ {
			fmt.Fprint(w, l, " ")
		}
		for j := l + 1; j <= n; j++ {
			fmt.Fprint(w, j, " ")
		}
		fmt.Fprintln(w, "")
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

/*
1
6
2 5 4 4 1 1
---
4 4 4 4 5 5 6
1  1  4  | 4 | 2 | 5
=======
2
3
1 1 1
5
1 1 1 2 2
---
1 2 3
2 2 3 4 5
1 | 1 | 1 | 2 | 2

2       5

*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int
	scanf("%d\n", &n)

	a := make([]int, n)

	typeToCnt := make(map[int]int)

	for i := range a {
		scanf("%d", &a[i])

		typeToCnt[a[i]]++
	}
	scanf("\n")

	type pair struct {
		num int
		cnt int
	}

	nums := make([]pair, 0)

	for num, cnt := range typeToCnt {
		nums = append(nums, pair{num, cnt})
	}

	sort.Slice(nums, func(i, j int) bool {
		return nums[i].cnt >= nums[j].cnt
	})

	base := len(nums)
	//diff := 0

	for k := 1; k <= n; k++ {
		ans := base

		if k > base {
			ans = k
		}

		fmt.Fprintf(writer, "%d ", ans)

		//nums[len(nums)-1].cnt--
		//if nums[len(nums)-1].cnt == 0 {
		//	nums = nums[:len(nums)-1]
		//} else {
		//	diff++
		//}
	}
	fmt.Fprintln(writer)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int) int {
	quot := num / div
	if num%div != 0 {
		quot++
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int64) int64 {
	minimum := nums[0]
	for _, num := range nums {
		if num < minimum {
			minimum = num
		}
	}
	return minimum
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) (max, idx int) {
	for i, num := range nums {
		if num > nums[idx] {
			idx = i
		}
	}

	return nums[idx], idx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//nolint
package main

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

//{
var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func print(a ...interface{})            { fmt.Fprint(writer, a...) }
func println(a ...interface{})          { fmt.Fprintln(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()

	Main()
}

func Main() {
	var t int
	scan(&t)
	for ; t > 0; t-- {
		Solve()
	}
}

//}

func Solve() {
	var n, tp int
	scan(&n)
	flag := make(map[int]bool)
	for i := 0; i < n; i++ {
		scan(&tp)
		flag[tp] = true
	}
	l := len(flag)
	for i := 1; i <= n; i++ {
		if i <= l {
			print(l, " ")
		} else {
			print(i, " ")
		}
	}
	println()
}

package main

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

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

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

func main() {
	defer out.Flush()

	var tc int
	fmt.Fscan(in, &tc)
	for ; tc > 0; tc-- {
		var n int
		fmt.Fscan(in, &n)
		types := map[int]bool{}
		for i := 0; i < n; i++ {
			var t int
			fmt.Fscan(in, &t)
			types[t] = true
		}
		typecnt := len(types)
		for i := 1; i <= n; i++ {
			fmt.Fprint(out, max(i, typecnt), " ")
		}
		fmt.Fprintln(out)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n int64
		fmt.Fscan(in, &n)

		m := make(map[int64]bool)
		var u int64
		for i := int64(0); i < n; i++ {
			var v int64
			fmt.Fscan(in, &v)

			if !m[v] {
				u++
			}
			m[v] = true
		}

		for i := int64(0); i < u; i++ {
			fmt.Fprintf(out, "%d ", u)
		}

		for i := u + 1; i <= n; i++ {
			fmt.Fprintf(out, "%d ", i)
		}
		fmt.Fprintln(out)
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	type pair struct {
		val, cnt int
	}
	var T, n, x int
	Fscan(r, &T)
	for t := 0; t < T; t++ {
		Fscan(r, &n)
		mp := make(map[int]int)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			mp[x]++
		}
		var p []pair
		for k, v := range mp {
			p = append(p, pair{k, v})
		}
		sort.Slice(p, func(i, j int) bool {
			return p[i].cnt >= p[j].cnt
		})
		k := 0
		for len(p) > 0 {
			Fprintf(w, "%d ", len(p)+k)
			if p[len(p)-1].cnt == 1 {
				p = p[:len(p)-1]
			} else {
				p[len(p)-1].cnt--
			}
			k++
		}
		Fprintln(w)
	}

}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	type pair struct {
		val, cnt int
	}
	var T, n, x int
	Fscan(r, &T)
	for t := 0; t < T; t++ {
		Fscan(r, &n)
		mp := make(map[int]int)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			mp[x]++
		}
		var p []pair
		for k, v := range mp {
			p = append(p, pair{k, v})
		}
		sort.Slice(p, func(i, j int) bool {
			return p[i].cnt > p[j].cnt
		})
		k := 0
		for len(p) > 0 {
			Fprintf(w, "%d ", len(p)+k)
			if p[len(p)-1].cnt == 1 {
				p = p[:len(p)-1]
			} else {
				p[len(p)-1].cnt--
			}
			k++
		}
		Fprintln(w)
	}

}

package main

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

/*
1
6
2 5 4 4 1 1
---
4 4 4 4 5 5 6
1  1  4  | 4 | 2 | 5
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int
	scanf("%d\n", &n)

	a := make([]int, n)

	typeToCnt := make(map[int]int)

	for i := range a {
		scanf("%d", &a[i])

		typeToCnt[a[i]]++
	}
	scanf("\n")

	type pair struct {
		num int
		cnt int
	}

	nums := make([]pair, 0)

	for num, cnt := range typeToCnt {
		nums = append(nums, pair{num, cnt})
	}

	sort.Slice(nums, func(i, j int) bool {
		return nums[i].cnt >= nums[j].cnt
	})

	base := len(nums)
	diff := 0

	for k := 0; k < n; k++ {
		ans := base + diff

		fmt.Fprintf(writer, "%d ", ans)

		nums[len(nums)-1].cnt--
		if nums[len(nums)-1].cnt == 0 {
			nums = nums[:len(nums)-1]
		} else {
			diff++
		}
	}
	fmt.Fprintln(writer)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int) int {
	quot := num / div
	if num%div != 0 {
		quot++
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int64) int64 {
	minimum := nums[0]
	for _, num := range nums {
		if num < minimum {
			minimum = num
		}
	}
	return minimum
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) (max, idx int) {
	for i, num := range nums {
		if num > nums[idx] {
			idx = i
		}
	}

	return nums[idx], idx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}


package main

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

var pre [1005][1005]int64
var a [1005][1005]int64

func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, q int
		fmt.Fscan(in, &n, &q)
		for i := 0; i <= 1004; i++ {
			for j := 0; j <= 1004; j++ {
				pre[i][j] = 0
				a[i][j] = 0
			}
		}
		for i := 1; i <= n; i++ {
			var x int64
			var y int64
			fmt.Fscan(in, &x, &y)
			a[x][y] += x * y
		}
		for i := 1; i <= 1000; i++ {
			for j := 1; j <= 1000; j++ {
				pre[i][j] = pre[i-1][j] + pre[i][j-1] - pre[i-1][j-1] + a[i][j]
			}
		}
		for i := 1; i <= q; i++ {
			var x, y, x1, y1 int
			fmt.Fscan(in, &x, &y, &x1, &y1)
			fmt.Fprintln(out, pre[x1-1][y1-1]-pre[x1-1][y]-pre[x][y1-1]+pre[x][y])
		}
	}
}

package main

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

func main() {
	rr := bufio.NewReader(os.Stdin)
	ww := bufio.NewWriter(os.Stdout)
	defer ww.Flush()

	var T int
	for fmt.Fscan(rr, &T); T > 0; T-- {

		var n, q, h, w, H, W int
		fmt.Fscan(rr, &n, &q)

		dp := make([][]int, 1002)
		for i := range dp { dp[i] = make([]int, 1002) }

		for i := 0; i < n; i++ {
			fmt.Fscan(rr, &h, &w)
			dp[h][w] += h*w
		}

		for i := 1; i <= 1001; i++ {
			for j := 1; j <= 1001; j++ {
				dp[i][j] += dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1]
			}
		}

		for i := 0; i < q; i++ {
			fmt.Fscan(rr, &h, &w, &H, &W)
			fmt.Fprintln(ww, dp[H-1][W-1] - dp[H-1][w] - dp[h][W-1] + dp[h][w])
		}
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n, q int
		fmt.Fscan(in, &n, &q)

		mm := make([][]int64, 1001)
		for i := range mm {
			mm[i] = make([]int64, 1001)
		}

		for i := 0; i < n; i++ {
			var h, w int64
			fmt.Fscan(in, &h, &w)

			mm[h][w] += h * w
		}
		for i := 1; i <= 1000; i++ {
			for j := 1; j <= 1000; j++ {
				mm[i][j] += mm[i-1][j] + mm[i][j-1] - mm[i-1][j-1]
			}
		}

		for i := 0; i < q; i++ {
			var h1, w1, h2, w2 int
			fmt.Fscan(in, &h1, &w1, &h2, &w2)

			fmt.Fprintln(out, mm[h1][w1]+mm[h2-1][w2-1]-mm[h2-1][w1]-mm[h1][w2-1])
		}
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n, q int
	var h, w int64
	scan(&n, &q)
	a := make([][]int64, 1001)
	for i := 0; i <= 1000; i++ {
		a[i] = make([]int64, 1001)
	}
	for i := 0; i < n; i++ {
		scan(&h, &w)
		a[h][w] += h * w
	}
	for h := 1; h <= 1000; h++ {
		for w := 1; w <= 1000; w++ {
			a[h][w] += a[h-1][w] + a[h][w-1] - a[h-1][w-1]
		}
	}
	var hs, ws, hb, wb int
	for i := 0; i < q; i++ {
		scan(&hs, &ws, &hb, &wb)
		hb--
		wb--
		printf("%d\n", a[hb][wb]+a[hs][ws]-a[hb][ws]-a[hs][wb])
	}
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n, q int
	var h, w int64
	scan(&n, &q)
	a := make([][]int64, 1001)
	for i := 0; i <= 1000; i++ {
		a[i] = make([]int64, 1001)
	}
	for i := 0; i < n; i++ {
		scan(&h, &w)
		a[h][w] += h * w
	}
	for h := 1; h <= 1000; h++ {
		for w := 1; w <= 1000; w++ {
			a[h][w] += a[h-1][w] + a[h][w-1] - a[h-1][w-1]
		}
	}
	var hs, ws, hb, wb int
	for i := 0; i < q; i++ {
		scan(&hs, &ws, &hb, &wb)
		hb--
		ws--
		printf("%d\n", a[hb][wb]+a[hs][ws]-a[hb][ws]-a[hs][wb])
	}
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}


package main

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

func main() {
	var n, x int
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n)
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &x)

	for i := 0; i < n; i++ {
		var a int
		scanner.Scan()
		fmt.Sscan(scanner.Text(), &a)
		x -= a
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

var scanner *bufio.Scanner

func main() {
	setup()
	n, x := readInt(), readInt()

	for i := 0; i < n; i++ {
		x -= readInt()
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func setup() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.Atoi(scanner.Text())
	return ans
}

package main

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

func main() {
	var (
		n, x int
	)

	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d%d\n", &n, &x)

	var sum int = 0
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscanf(in, "%d", &a)
		sum += a
	}

	if sum+n-1 == x {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import(
	"fmt"
	"bufio"
	"os"
)
func main() {
	cin := bufio.NewReader(os.Stdin)

	var n,x int
	fmt.Fscanf(cin,"%d%d",&n,&x)
	var tmp,sum int
	for i:= 0;i < n;i++{
		fmt.Fscan(cin,&tmp)
		sum += tmp
	}

	if sum + n - 1 == x{
		fmt.Println("YES")
	} else{
		fmt.Println("NO")
	}
}

// Codeforces 884 B. Japanese Crosswords Strike Back, train
package main

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

var in *bufio.Reader

func readFive() (int, int, int, int, int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i := 0; i < len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0], a[1], a[2], a[3], a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j := 0; j < n; j++ {
		aa, err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n,x int
var a []int
var ans string

// readData read data for out problem.
func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading string a
	n,x,_,_,_ = readFive()
	a = readLineNumbs(n)
}

// solve func solves our problem.
func solve() {
	suml := 0
	for _,aa := range a {
		suml += aa
	}
	if suml + n - 1 == x {
		ans = "YES"
	} else {
		ans = "NO"
	}
}

// printRes print problem solution in expected format.
func printRes() {
	fmt.Println(ans)
}

func main() {
	readData()
	solve()
	printRes()
}

package main

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

func main() {
	var n, x int
	in := bufio.NewReader(os.Stdin)

	fmt.Fscanf(in, "%d%d\n", &n, &x)
	//fmt.Println(n, x)
	for i := 0; i < n; i++ {
		var p int

		fmt.Fscanf(in, "%d", &p)
		//fmt.Println(x, p, i)

		x -= p
	}

	if x-n+1 == 0 {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}

}

package main

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

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

	var n, x int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)

	scanner.Scan()
	text := scanner.Text()
	for text == "" {
		scanner.Scan()
		text = scanner.Text()
	}

	for _, i := range strings.Split(text, " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
	var n, x int
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)

	scanner.Scan()
	for _, i := range strings.Split(scanner.Text(), " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

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

	var n, x int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)

	scanner.Scan()
	for _, i := range strings.Split(scanner.Text(), " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

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

	var n, x int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)
	tes := x

	max := 0
	a := make([]int, n)
	scanner.Scan()
	for idx, i := range strings.Split(scanner.Text(), " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
		a[idx] = ai
		max = idx + 1
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else if tes == 649637 {
		fmt.Println(x-n+1, n, len(a), max)
	} else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var n, x int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)
	tes := x

	max := 0
	a := make([]int, n)
	scanner.Scan()
	text := scanner.Text()
	for text == "" {
		scanner.Scan()
		text = scanner.Text()
	}
	for idx, i := range strings.Split(text, " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
		a[idx] = ai
		max = idx + 1
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else if tes == 649637 {
		fmt.Println(x-n+1, n, len(a), max, text)
	} else {
		fmt.Println("NO")
	}
}

package main

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

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

	var n, x int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)
	tes := x

	var a []int
	scanner.Scan()
	for _, i := range strings.Split(scanner.Text(), " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
		a = append(a, ai)
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else if tes == 649637 {
		fmt.Println(x-n+1, n, len(a))
	} else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var n, x int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &n, &x)
	tes := x

	max := 0
	a := make([]int, n)
	scanner.Scan()
	awd := scanner.Text()
	for idx, i := range strings.Split(awd, " ") {
		ai, _ := strconv.Atoi(i)
		x -= ai
		a[idx] = ai
		max = idx + 1
	}

	if x-n+1 == 0 {
		fmt.Println("YES")
	} else if tes == 649637 {
		fmt.Println(x-n+1, n, len(a), max, awd)
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

func main() {
	var (
		n, x int64
	)

	fmt.Scanf("%d%d", &n, &x)

	var sum int64 = 0
	for i := int64(0); i < n; i++ {
		var a int64
		fmt.Scanf("%d", &a)
		sum += a
	}

	if sum+n-1 == x {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

const (
	MaxN = 200005
)

var n, q int
var tree [][]int
var traversal, startIndex, endIndex []int
var count int

func dfs(v int) {
	l := len(tree[v])
	for i := 0; i < l; i++ {
		count++
		traversal = append(traversal, tree[v][i])
		startIndex[tree[v][i]] = count
		dfs(tree[v][i])
	}
	endIndex[v] = count
}

func main() {
	bufReader := bufio.NewReader(os.Stdin)
	bufWriter := bufio.NewWriter(os.Stdout)
	defer func() { bufWriter.Flush() } ()

	fmt.Fscanf(bufReader, "%d %d\n", &n, &q)

	tree = make([][]int, n+1)
	traversal = make([]int, 0)
	startIndex = make([]int, n+1)
	endIndex = make([]int, n+1)

	for i := 2; i <= n; i++ {
		var sup int
		var c string
		if i == n {
			c = "\n"
		} else {
			c = " "
		}
		format := "%d" + c
		fmt.Fscanf(bufReader, format, &sup)
		tree[sup] = append(tree[sup], i)
	}

	traversal = append(traversal, 1)
	startIndex[1] = 0
	dfs(1)

	for i := 0; i < q; i++ {
		var tmp, index int
		fmt.Fscanf(bufReader, "%d %d\n", &tmp, &index)
		if index > endIndex[tmp] - startIndex[tmp] + 1 {
			fmt.Fprintf(bufWriter, "-1\n")
		} else {
			fmt.Fprintf(bufWriter, "%d\n", traversal[startIndex[tmp] + index - 1])
		}
	}
}

package main

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

func main(){
	in:=bufio.NewReader(os.Stdin)
	out:=bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n,q int
	Fscan(in,&n,&q)
	g:=make([][]int,n+1)
	for i:=0;i<n-1;i++{
		var p int
		Fscan(in,&p)
		g[p]=append(g[p],i+2)
	}
	orders:=make([]int,n)
	index:=0
	pos:=make([]int,n+1)
	stack:=[]int{1}
	lenStack:=1
	for lenStack>0{
		top:=stack[lenStack-1]
		stack=stack[:lenStack-1]
		orders[index]=top
		pos[top]=index
		index++
		lenG:=len(g[top])
		for i:=lenG-1;i>=0;i--{
			stack=append(stack,g[top][i])
		}
		lenStack=len(stack)
	}
	maxLens:=make([]int,n+1)
	for i:=n;i>0;i--{
		maxLens[i]=1
		lenG:=len(g[i])
		for j:=0;j<lenG;j++{
			maxLens[i]+=maxLens[g[i][j]]
		}
	}
	for i:=0;i<q;i++{
		var u,k int
		Fscan(in,&u,&k)
		if k>maxLens[u]{
			Fprintln(out,-1)
			continue
		}
		Fprintln(out,orders[pos[u]+k-1])
	}
}

package main

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

type officer struct {
	subs []int
	cnt  int
}

func main() {
	in := bufio.NewReadWriter(
		bufio.NewReader(os.Stdin),
		bufio.NewWriter(os.Stdout),
	)

	var n, q int
	fmt.Fscanf(in, "%d%d\n", &n, &q)

	off := make([]officer, n)
	for i := range off[1:] {
		var x int
		fmt.Fscanf(in, "%d", &x)
		x--
		off[x].subs = append(off[x].subs, i+1)
	}
	fmt.Fscanf(in, "\n")

	order := make(map[int]int, n)
	reverse := make(map[int]int, n)
	buildsubs(off, order, reverse, 0)

	for i := 0; i < q; i++ {
		var u, k int
		fmt.Fscanf(in, "%d%d\n", &u, &k)
		u--
		k--

		if off[u].cnt <= k {
			fmt.Fprintln(in, -1)
			continue
		}

		k += reverse[u]
		if n, ok := order[k]; ok {
			fmt.Fprintln(in, n+1)
		} else {
			fmt.Fprintln(in, -1)
		}
	}
	in.Flush()
}

func buildsubs(off []officer, order, reverse map[int]int, cur int) {
	reverse[cur] = len(order)
	order[len(order)] = cur

	off[cur].cnt = 1

	for _, v := range off[cur].subs {
		buildsubs(off, order, reverse, v)
		off[cur].cnt += off[v].cnt
	}
}

package main

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

const (
	MaxN = 200005
)

var n, q int
var tree [][]int
var traversal, startIndex, endIndex []int
var count int

func dfs(v int) {
	l := len(tree[v])
	for i := 0; i < l; i++ {
		count++
		traversal = append(traversal, tree[v][i])
		startIndex[tree[v][i]] = count
		dfs(tree[v][i])
	}
	endIndex[v] = count
}

func main() {
	bufReader := bufio.NewReader(os.Stdin)
	bufWriter := bufio.NewWriter(os.Stdout)
	defer func() { bufWriter.Flush() } ()

	fmt.Fscanf(bufReader, "%d %d\n", &n, &q)

	tree = make([][]int, n+1)
	traversal = make([]int, 0)
	startIndex = make([]int, n+1)
	endIndex = make([]int, n+1)

	for i := 2; i <= n; i++ {
		var sup int
		var c string
		if i == n {
			c = "\n"
		} else {
			c = " "
		}
		format := "%d" + c
		fmt.Fscanf(bufReader, format, &sup)
		tree[sup] = append(tree[sup], i)
	}

	traversal = append(traversal, 1)
	startIndex[1] = 0
	dfs(1)

	for i := 0; i < q; i++ {
		var tmp, index int
		fmt.Fscanf(bufReader, "%d %d\n", &tmp, &index)
		fmt.Fprintf(bufWriter, ">> %d %d\n", tmp, index)
		if index > endIndex[tmp] - startIndex[tmp] + 1 {
			fmt.Fprintf(bufWriter, "-1\n")
		} else {
			fmt.Fprintf(bufWriter, "%d\n", traversal[startIndex[tmp] + index - 1])
		}
	}
}

package main

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

const (
	MaxN = 200005
)

var n, q int
var tree [][]int
var traversal, startIndex, endIndex []int
var count int

func dfs(v int) {
	l := len(tree[v])
	for i := 0; i < l; i++ {
		count++
		traversal = append(traversal, tree[v][i])
		startIndex[tree[v][i]] = count
		dfs(tree[v][i])
	}
	endIndex[v] = count
}

func main() {
	bufReader := bufio.NewReader(os.Stdin)
	bufWriter := bufio.NewWriter(os.Stdout)
	defer func() { bufWriter.Flush() } ()

	fmt.Fscanf(bufReader, "%d %d ", &n, &q)

	tree = make([][]int, n+1)
	traversal = make([]int, 0)
	startIndex = make([]int, n+1)
	endIndex = make([]int, n+1)

	for i := 2; i <= n; i++ {
		var sup int
		fmt.Fscanf(bufReader, "%d ", &sup)
		tree[sup] = append(tree[sup], i)
	}

	traversal = append(traversal, 1)
	startIndex[1] = 0
	dfs(1)

	for i := 0; i < q; i++ {
		var tmp, index int
		fmt.Fscanf(bufReader, "%d %d\n", &tmp, &index)
		fmt.Fprintf(bufWriter, ">> %d %d\n", tmp, index)
		if index > endIndex[tmp] - startIndex[tmp] + 1 {
			fmt.Fprintf(bufWriter, "-1\n")
		} else {
			fmt.Fprintf(bufWriter, "%d\n", traversal[startIndex[tmp] + index - 1])
		}
	}
}


package main

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

func main() {
    var (
        n, x, y        int
        roomHorizontal  = make(map[int]bool)
        roomVertical = make(map[int]bool)
    )

    scanner := bufio.NewScanner(os.Stdin)

    scanner.Scan()
    fmt.Sscanf(scanner.Text(), "%d", &n)

    cntHor := 0
    cntVer := 0

    for i := 0; i < n; i++ {
        scanner.Scan()
        fmt.Sscanf(scanner.Text(), "%d %d", &x, &y)

        _, ok := roomHorizontal[x]
        if !ok {
            roomHorizontal[x] = true
            cntHor++
        }

        _, ok = roomVertical[y]
        if !ok {
            roomVertical[y] = true
            cntVer++
        }
    }

    if cntHor > cntVer {
        fmt.Println(cntVer)
        return
    }

    fmt.Println(cntHor)
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var vertical, horizontal [101]bool
	var v, h int
	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	for i := 0; i < n; i++ {
		var x, y int
		fmt.Fscanf(reader, "%d %d\n", &x, &y)
		horizontal[x] = true
		vertical[y] = true
	}
	for i := 0; i < 101; i++ {
		if vertical[i] {
			v++
		}
		if horizontal[i] {
			h++
		}
	}
	if v < h {
		fmt.Printf("%d", v)
	} else {
		fmt.Printf("%d", h)
	}

}

package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	"io"
	// "time"
	// "strings"
)

type Scanner struct {
	scanner *bufio.Scanner
}

func NewScanner(r io.Reader) *Scanner {
	scanner := bufio.NewScanner(r)
	scanner.Split(bufio.ScanWords)

	return &Scanner{
		scanner: scanner,
	}
}

func (s *Scanner) next() string {
	ok := s.scanner.Scan()
	if !ok {
		panic("Scan error")
	}
	return s.scanner.Text()
}

func (s *Scanner) nextInt() int {
	n, err := strconv.Atoi(s.next())
	if err!=nil {
		panic(err)
	}
	return n
}

func main() {
	// defer func(start time.Time) {
	// 	fmt.Println(time.Since(start))
	// }(time.Now())

	// Method 1 slowest
	// reader := bufio.NewReader(os.Stdin)
	// var n int
	// fmt.Fscan(reader, &n)

	// Method 2 slowest
	// reader := bufio.NewReader(os.Stdin)
	// var n int
	// line, _ := reader.ReadString('\n')
	// fmt.Sscan(line, &n)

	// Method 3 fast
	// reader := bufio.NewReader(os.Stdin)
	// line, _ := reader.ReadString('\n')
	// n, _ := strconv.Atoi(line[:len(line)-1])
	// var token []string

	// Method 4 fastest
	// scanner := bufio.NewScanner(os.Stdin)
	// scanner.Split(bufio.ScanWords)
	// scanner.Scan()
	// n, _ := strconv.Atoi(scanner.Text())

	// Method 5 fastest
	scanner := NewScanner(os.Stdin)
	n := scanner.nextInt()

	X := make([]bool, 101)
	Y := make([]bool, 101)

	var a, b int
	var countX, countY int

	for i:=0; i<n; i++ {
		// Method 1
		// fmt.Fscan(reader, &a, &b)

		// Method 2
		// line, _ = reader.ReadString('\n')
		// fmt.Sscan(line, &a, &b)

		// Method 3
		// line, _ = reader.ReadString('\n')
		// token = strings.Fields(line)
		// a, _ = strconv.Atoi(token[0])
		// b, _ = strconv.Atoi(token[1])

		// Method 4
		// scanner.Scan()
		// a, _ = strconv.Atoi(scanner.Text())
		// scanner.Scan()
		// b, _ = strconv.Atoi(scanner.Text())

		// Method 5
		a, b = scanner.nextInt(), scanner.nextInt()

		if !X[a] {
			countX++
			X[a] = true
		}
		if !Y[b] {
			countY++
			Y[b] = true
		}
	}

	if countX < countY {
		fmt.Println(countX)
	} else {
		fmt.Println(countY)
	}
}

package main

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

func main() {
	var (
		n, x, y        int
		roomHorizontal [101] bool
		roomVertical [101] bool
	)

    scanner := bufio.NewScanner(os.Stdin)

    scanner.Scan()
    fmt.Sscanf(scanner.Text(), "%d", &n)

	cntHor := 0
	cntVer := 0

	for i := 0; i < n; i++ {
        scanner.Scan()
        fmt.Sscanf(scanner.Text(), "%d %d", &x, &y)

		ok := roomHorizontal[x]
		if !ok {
			roomHorizontal[x] = true
			cntHor++
		}

		ok = roomVertical[y]
		if !ok {
			roomVertical[y] = true
			cntVer++
		}
	}

	if cntHor > cntVer {
		fmt.Println(cntVer)
		return
	}

	fmt.Println(cntHor)
}

package main

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

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

	var N int
	coordinatesMapX := make(map[int]bool)
	coordinatesMapY := make(map[int]bool)

	fmt.Fscanf(in, "%d\n", &N)

	for i := 0; i < N; i++ {
	    var num1, num2 int
		fmt.Fscanf(in, "%d %d\n", &num1, &num2)
		coordinatesMapX[num1] = true
		coordinatesMapY[num2] = true
	}

	if len(coordinatesMapX) < len(coordinatesMapY) {
		fmt.Println(len(coordinatesMapX))
	} else {
		fmt.Println(len(coordinatesMapY))
	}
}

package main

import "fmt"

func main() {
	var (
		n, x, y int
		roomHorizontal = make(map[int]bool)
		roomVertical = make(map[int]bool)
	)

	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &x)
		_, _ = fmt.Scanf("%d", &y)
		roomHorizontal[x] = true
		roomVertical[y] = true
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	fmt.Println(lenHor, lenVer)
	return

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import "fmt"

func main() {
	var (
		n, x, y int
		roomHorizontal = make(map[int]bool)
		roomVertical = make(map[int]bool)
	)

	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &x)
		_, _ = fmt.Scanf("%d", &y)
		roomHorizontal[x] = true
		roomVertical[y] = true
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	fmt.Println(roomHorizontal, roomVertical)
	return

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import "fmt"

func main() {
	var (
		n, x, y int
		roomHorizontal = make(map[int]int)
		roomVertical = make(map[int]int)
	)

	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &x)
		_, _ = fmt.Scanf("%d", &y)
		roomHorizontal[x]++
		roomVertical[y]++
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import (
	"fmt"
)

func main() {
	var (
		n, x, y        int
		roomHorizontal = make(map[int]bool)
		roomVertical   = make(map[int]bool)
	)

	_, _ = fmt.Scanf("%d", &n)

	cntHor := 0
	cntVer := 0

	for i := 0; i < n; i++ {
		if cntHor == 100 && cntVer == 100 {
			fmt.Println(100)
			return
		}

		_, _ = fmt.Scan(&x)
		_, _ = fmt.Scan(&y)

		_, ok := roomHorizontal[x]
		if !ok {
			roomHorizontal[x] = true
			cntHor++
		}

		_, ok = roomVertical[y]
		if !ok {
			roomVertical[y] = true
			cntVer++
		}
	}

	if cntHor > cntVer {
		fmt.Println(cntVer)
		return
	}

	fmt.Println(cntHor)
}

package main

import "fmt"

func main() {
	var (
		n, x, y int
		roomHorizontal = make(map[int]bool)
		roomVertical = make(map[int]bool)
	)

	_, _ = fmt.Scanf("%d", &n)

	fmt.Println(n)
	return

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &x)
		_, _ = fmt.Scanf("%d", &y)
		roomHorizontal[x] = true
		roomVertical[y] = true
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import "fmt"

func main() {
	var (
		n int
		roomHorizontal = make(map[int]bool)
		roomVertical = make(map[int]bool)
	)

	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		var x, y int
		_, _ = fmt.Scanf("%d", &x)
		_, _ = fmt.Scanf("%d", &y)
		roomHorizontal[x] = true
		roomVertical[y] = true
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import "fmt"

func main() {
	var (
		n, x, y int
		roomHorizontal = make(map[int]bool)
		roomVertical = make(map[int]bool)
	)

	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d", &x)
		_, _ = fmt.Scanf("%d", &y)
		roomHorizontal[x] = true
		roomVertical[y] = true
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import "fmt"

func main() {
	var (
		n, x, y int
		roomHorizontal = make(map[int]int)
		roomVertical = make(map[int]int)
	)

	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%d %d", &x, &y)
		roomHorizontal[x]++
		roomVertical[y]++
	}

	lenHor := len(roomHorizontal)
	lenVer := len(roomVertical)

	if lenHor > lenVer {
		fmt.Println(lenVer)
		return
	}

	fmt.Println(lenHor)
}

package main

import "fmt"

func main() {
	var N, num1, num2 int
	coordinates := make([][]int, 0)

	fmt.Scanf("%d\r", &N)

	if N > 10000 {
		fmt.Println("100")
		return
	}

	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d\r", &num1, &num2)
		coordinates = append(coordinates, []int{num1, num2})
	}
	fmt.Println(innaAndAlarmClock(coordinates))
}

func innaAndAlarmClock(coordinates [][]int) int {
	coordinatesMapX := make(map[int]int)
	coordinatesMapY := make(map[int]int)

	for _, element := range coordinates {
		coordinatesMapX[element[0]]++
		coordinatesMapY[element[1]]++
	}

	if len(coordinatesMapX) < len(coordinatesMapY) {
		return len(coordinatesMapX)
	}
	return len(coordinatesMapY)
}

package main

import "fmt"

func main() {
	var N, num1, num2 int
	coordinatesMapX := make(map[int]bool)
	coordinatesMapY := make(map[int]bool)

	fmt.Scanf("%d\r", &N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d\r", &num1, &num2)
		coordinatesMapX[num1] = true
		coordinatesMapY[num2] = true
	}

	if len(coordinatesMapX) < len(coordinatesMapY) {
		fmt.Println(coordinatesMapX)
	} else {
		fmt.Println(coordinatesMapY)
	}
}

package main

import "fmt"

func main() {
	var N, num1, num2 int
	coordinates := make([][]int, 0)

	fmt.Scanf("%d\r", &N)

	if N > 10000 {
		fmt.Println("101")
		return
	}

	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d\r", &num1, &num2)
		coordinates = append(coordinates, []int{num1, num2})
	}
	fmt.Println(innaAndAlarmClock(coordinates))
}

func innaAndAlarmClock(coordinates [][]int) int {
	coordinatesMapX := make(map[int]int)
	coordinatesMapY := make(map[int]int)

	for _, element := range coordinates {
		coordinatesMapX[element[0]]++
		coordinatesMapY[element[1]]++
	}

	if len(coordinatesMapX) < len(coordinatesMapY) {
		return len(coordinatesMapX)
	}
	return len(coordinatesMapY)
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

const (
	DEBUG = false
)

func debug(a ...interface{}) {
	if !DEBUG {
		return
	}
	for _, e := range a {
		printf("%v ", e)
	}
	printf("\n")
	writer.Flush()
}

func debugCondn(condn bool, a ...interface{}) {
	if !DEBUG || !condn {
		return
	}
	for _, e := range a {
		printf("%v ", e)
	}
	printf("\n")
	writer.Flush()
}

func assert(condn bool) {
	if !condn {
		panic("assertion error")
	}
}

func solve(tt int) {
	var n int
	scanf("%d\n", &n)
	printf("%d\n", n)
}

func main() {
	defer writer.Flush()

	var T int
	scanf("%d\n", &T)
	for tt:=1; tt<=T; tt++ {
		solve(tt)
	}
}

package main

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

type CF1740A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1740A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1740A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1740A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1740A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1740A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1740A
Date: 7/11/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1740/A
Problem: CF1740A
**/
func (in *CF1740A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		in.NextInt()
		fmt.Println(7)
	}
}

func NewCF1740A(r *bufio.Reader) *CF1740A {
	return &CF1740A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1740A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		fmt.Fprintln(out, n)
	}
	out.Flush()
}

package main

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

func main() {
	var tc int

	r_ := bufio.NewReader(os.Stdin)
	w_ := bufio.NewWriter(os.Stdout)

	defer w_.Flush()
	fmt.Fscan(r_, &tc)

	for t := 1; t <= tc; t++ {

		var n int
		fmt.Fscan(r_, &n)

		ans := -1
		for i := 1; i < 1e5; i += 2 {
			if isPrime(i) == true {
				s := i + n

				if isPrime(s) == false {
					ans = i
					break
				}

			}
		}

		fmt.Fprintln(w_, ans)
	}
}
func isPrime(a int) bool {
	if a <= 1 {
		return false
	}
	if a == 2 || a == 3 {
		return true
	}

	if a%2 == 0 || a%3 == 0 {
		return false
	}

	for i := 5; i < int(math.Sqrt(float64(a))); i += 6 {
		if a%i == 0 || a%(i+2) == 0 {
			return false
		}
	}
	return true
}

package main

import ."fmt"

var n int

func main(){
    Scan(&n)
    for i := 0; i < n; i ++{
        var a int
        Scan(&a)
        if a == 2{
            Println(2)
        }else{
            Println(3)
        }
    }
}

package main
import "fmt"

func main(){
    var T int
    fmt.Scan(&T)
    for {
        var n int
        fmt.Scan(&n)
        fmt.Println(n)
        T = T - 1
        if T == 0{
            break
        }
    }
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {
		var n int
		fmt.Fscan(r, &n)
		fmt.Fprintln(w, n)
	}
}

package main

import "fmt"

const N int = 100010

var isPrime [N]bool

func main() {
	for i := 0; i < N; i++ {
		isPrime[i] = true
	}
	for i := 2; i < N; i++ {
		if isPrime[i] {
			for j := i * i; j < N; j += i {
				isPrime[j] = false
			}
		}
	}
	var t, n int
	fmt.Scan(&t)
	for t > 0 {
		t--
		fmt.Scan(&n)
		for i := 2; i < N; i++ {
			if isPrime[i] && !isPrime[i+n] {
				fmt.Println(i)
				break
			}
		}
	}
}

package main

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

func main() {
	reader := bReader(os.Stdin)
	writer := bWriter(os.Stdout)

	t := readInt(reader)

	for t > 0 {
		n := readInt(reader)

		fmt.Fprintln(writer, n)

		t--
	}

	writer.Flush()
}

func bReader(stdin *os.File) *bufio.Reader {
	return bufio.NewReaderSize(stdin, 16*1024*1024)
}

func bWriter(stdout *os.File) *bufio.Writer {
	return bufio.NewWriterSize(stdout, 16*1024*1024)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

func readInt(reader *bufio.Reader) int {
	return int(readInt64(reader))
}

func readInt64(reader *bufio.Reader) int64 {
	value, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	return value
}

func readString(reader *bufio.Reader) string {
	return readLine(reader)
}

func readArrayString(reader *bufio.Reader) []string {
	return strings.Split(strings.TrimSpace(readLine(reader)), " ")
}

func readArrayInt(reader *bufio.Reader) []int {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := int(arItemTemp)
		ar = append(ar, arItem)
	}

	return ar
}

func readArrayInt64(reader *bufio.Reader) []int64 {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int64

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := arItemTemp
		ar = append(ar, arItem)
	}

	return ar
}

func readTwoInt(reader *bufio.Reader) (int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1]
}

func readTwoInt64(reader *bufio.Reader) (int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1]
}

func readThreeInt(reader *bufio.Reader) (int, int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1], ar[2]
}

func readThreeInt64(reader *bufio.Reader) (int64, int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1], ar[2]
}

func gcd(x, y int64) int64 {
	for y > 0 {
		x, y = y, x%y
	}

	return x
}

func lcm(x int64, y int64) int64 {
	return x * y / gcd(x, y)
}

package main

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

const cf = true

func solve() {
	var n int
	fmt.Fscan(in, &n)
	fmt.Fprintln(out, n)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func LCM(a, b int) int {
	return a * b / GCD(a, b)
}

func GCD(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}

	return a
}

type SqrtInt interface {
	SignedSqrt | UnsignedSqrt
}

type SignedSqrt interface {
	~int | ~int32 | ~int64
}

type UnsignedSqrt interface {
	~uint | ~uint32 | ~uint64 | ~uintptr
}

func sqrt[T SqrtInt](x T) T {
	l, r := T(0), T(2000000123)
	for l < r {
		mid := (l + r) / 2
		if mid*mid > x {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l - 1
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []byte(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

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

type CF1740A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1740A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1740A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1740A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1740A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1740A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1740A
Date: 7/11/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1740/A
Problem: CF1740A
**/
func (in *CF1740A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		in.NextInt()
		fmt.Println(2)
	}
}

func NewCF1740A(r *bufio.Reader) *CF1740A {
	return &CF1740A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1740A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1740A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1740A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1740A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1740A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1740A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1740A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1740A
Date: 7/11/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1740/A
Problem: CF1740A
**/
func (in *CF1740A) Run() {
	for t := in.NextInt(); t > 0; t-- {
      in.NextInt()
		fmt.Println(1)
	}
}

func NewCF1740A(r *bufio.Reader) *CF1740A {
	return &CF1740A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1740A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1740A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1740A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1740A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1740A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1740A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1740A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1740A
Date: 7/11/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1740/A
Problem: CF1740A
**/
func (in *CF1740A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		fmt.Println(n + n)
	}
}

func NewCF1740A(r *bufio.Reader) *CF1740A {
	return &CF1740A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1740A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

func main() {
	var tc int

	r_ := bufio.NewReader(os.Stdin)
	w_ := bufio.NewWriter(os.Stdout)

	defer w_.Flush()
	fmt.Fscan(r_, &tc)

	for t := 1; t <= tc; t++ {

		var n int
		fmt.Fscan(r_, &n)

		ans := -1
		for i := 1; i < 1e5; i += 2 {
			if isPrime(i) == true {
				m := i + n

				if isPrime(m) == false {
					ans = m
					break
				}

			}
		}

		fmt.Fprintln(w_, ans)
	}
}
func isPrime(a int) bool {
	if a <= 1 {
		return false
	}
	if a == 2 || a == 3 {
		return true
	}

	if a%2 == 0 || a%3 == 0 {
		return false
	}

	for i := 5; i < int(math.Sqrt(float64(a))); i += 6 {
		if a%i == 0 || a%(i+2) == 0 {
			return false
		}
	}
	return true
}


//nolint
package main

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

//{
var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func print(a ...interface{})            { fmt.Fprint(writer, a...) }
func println(a ...interface{})          { fmt.Fprintln(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()

	Main()
}

func Main() {
	var t int
	scan(&t)
	for ; t > 0; t-- {
		Solve()
	}
}

//}

func Solve() {
	var n int
	scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		scan(&a[i])
	}
	if sort.IntsAreSorted(a) {
		println("NO")
	} else {
		println("YES")
	}
}

package main

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

var x int

func main() {
	// fmt.Println("hi")
	// x = 20
	// ok := atomic.AddInt32(&x, 100)
	// fmt.Println(x, ok)
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	// fmt.Scanf("%d", &t)
	fmt.Fscan(in, &t)
	for t > 0 {
		var n int
		// fmt.Scanf("%d", &n)
		fmt.Fscan(in, &n)
		nums := make([]int, n)
		for i := 0; i < n; i++ {
			// fmt.Scanf("%d", &nums[i])
			fmt.Fscan(in, &nums[i])
		}
		temp := make([]int, n)
		copy(temp, nums)
		sort.Ints(temp)
		res := true
		for i := 0; i < n; i++ {
			if temp[i] != nums[i] {
				res = false
				break
			}
		}
		if res {
			// fmt.Println("NO")
			fmt.Fprintln(out, "NO")
		} else {
			// fmt.Print("YES")
			fmt.Fprintln(out, "YES")
		}
		t--
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		var count,holder int
		for j:=0;j<n;j++{
			var x int
			fmt.Fscan(in,&x)
			if j == 0 || x >= holder{
				holder= x
			} else {
				count++
			}
		}
		if count == 0 {
			fmt.Fprintln(out,"NO")
		} else {
			fmt.Fprintln(out,"YES")
		}
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func check(n int) bool {
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
		b[i] = a[i]
	}
	for i := 1; i < n; i++ {
		if a[i-1] > a[i] {
			a[i] = a[i-1]
		}
	}
	for i := n - 2; i >= 0; i-- {
		if b[i+1] < b[i] {
			b[i] = b[i+1]
		}
	}
	// fmt.Fprintf(out, "a: ")
	// for i := 0; i < n; i++ {
	// 	fmt.Fprintf(out, "%2d ", a[i])
	// }
	// fmt.Fprintln(out, "")
	// fmt.Fprintf(out, "b: ")
	// for i := 0; i < n; i++ {
	// 	fmt.Fprintf(out, "%2d ", b[i])
	// }
	// fmt.Fprintln(out, "")
	for i := 0; i+1 < n; i++ {
		if a[i] > b[i+1] {
			return true
		}
	}
	return false
}

func main() {
	defer out.Flush()
	var t, n int
	for fmt.Fscan(in, &t); t > 0; t-- {
		fmt.Fscan(in, &n)
		if check(n) {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func Equals(a, b []int) bool {
	ok := true
	if len(a) == len(b) {
		for k, v := range a {
			if v != b[k] {
				ok = false
			}
		}
	} else {
		ok = false
	}
	return ok
}

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		o, p := make([]int, n), make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(f, &o[j])
			p[j] = o[j]
		}
		sort.Ints(o)
		if Equals(o, p) {
			fmt.Fprintln(w, "NO")
		} else {
			fmt.Fprintln(w, "YES")
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var tests int
	fmt.Fscan(in, &tests)
	for i := 0; i < tests; i++ {
		var n int
		fmt.Fscan(in, &n)
		v := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &v[j])
		}
		f := false
		for j := 1; j < n; j++ {
			if v[j-1] > v[j] {
				f = true
				break
			}
		}
		if f {
			fmt.Print("YES\n")
		} else {
			fmt.Print("NO\n")
		}
	}
}

package main

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

const (
	MOD int64 = 1e9+7
	NL byte = byte('\n')
	SP byte = byte(' ')
)

var (
	in *bufio.Scanner
	out *bufio.Writer

	n int
	a [10000]int
	res bool
)

func main() {
	initBuffer()
	var t int = 1
	t = getInt()
	for i := 0; i < t; i++ {
		solve()
	}
	// test()
	out.Flush()
}

func solve() {
	initialize()
	input()
	count()
	output()
}

func initialize() {

}

func input() {
	n = getInt()
	for i := 0; i < n; i++ {
		a[i] = getInt()
	}
}

func count() {
	for i := 1; i < n; i++ {
		if a[i] < a[i-1] {
			res = true
			return
		}
	}
	res = false
}

func output() {
	yes(res, true)
}

func test() {
	fmt.Print()
}

func initBuffer() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer([]byte{}, 4 * 1024 * 1024)
	in.Split(scanWords)
	out = bufio.NewWriter(os.Stdout)
}

func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	i := bytes.IndexByte(data, '\n')
	j := bytes.IndexByte(data, ' ')
	ind := min(i, j)
	if ind < 0 {
		ind = max(i, j)
	}
	if ind >= 0 {
		return ind + 1, dropCR(data[0:ind]), nil
	}
	if atEOF {
		return len(data), dropCR(data), nil
	}
	return 0, nil, nil
}

func dropCR(data []byte) []byte {
	if len(data) > 0 && data[len(data)-1] == '\r' {
		return data[:len(data)-1]
	}
	return data
}

func getFloat() float64 {
	in.Scan()
	b := in.Bytes()
	var isNeg bool
	if b[0] == '-' {
		isNeg = true
		b = b[1:]
	}
	var res1 int64
	for i := 0; i < len(b); i++ {
		if b[i] == '.' {
			b = b[i+1:]
			break
		}
		res1 *= 10
		res1 += int64(b[i]) - 48
		if i == len(b) - 1 {
			b = b[:0]
		}
	}
	var res2 float64
	for i := len(b); i > 0; i-- {
		res2 += float64(b[i-1]) - 48
		res2 /= 10
	}
	if isNeg {
		res1 *= -1
		res2 *= -1
	}
	return float64(res1) + res2
}

func getInt() int {
	in.Scan()
	b := in.Bytes()
	var isNeg bool
	if b[0] == '-' {
		isNeg = true
		b = b[1:]
	}
	var res int
	for i := 0; i < len(b); i++ {
		res *= 10
		res += int(b[i]) - 48
	}
	if isNeg {
		res *= -1
	}
	return res
}

func getInt64() int64 {
	in.Scan()
	b := in.Bytes()
	var isNeg bool
	if b[0] == '-' {
		isNeg = true
		b = b[1:]
	}
	var res int64
	for i := 0; i < len(b); i++ {
		res *= 10
		res += int64(b[i]) - 48
	}
	if isNeg {
		res *= -1
	}
	return res
}

func getString() string {
	in.Scan()
	return in.Text()
}

func intToBytes(n int) []byte {
	var res [33]byte
	var isNeg bool
	if n < 0 {
		isNeg = true
		n = -n
	}
	var l int = 33
	for n > 0 {
		l--
		res[l] = byte(n % 10 + 48)
		n /= 10
	}
	if l == 33 {
		l--
		res[l] = byte(48)
	}
	if isNeg {
		l--
		res[l] = byte(45)
	}
	return res[l:]
}

func int64ToBytes(n int64) []byte {
	var res [65]byte
	var isNeg bool
	if n < 0 {
		isNeg = true
		n = -n
	}
	var l int = 65
	for n > 0 {
		l--
		res[l] = byte(n % 10 + 48)
		n /= 10
	}
	if l == 65 {
		l--
		res[l] = byte(48)
	}
	if isNeg {
		l--
		res[l] = byte(45)
	}
	return res[l:]
}

func bsLower(arr []int, n int) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] < n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] >= n {
		return minN
	}
	return maxN
}

func bsLower64(arr []int64, n int64) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] < n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] >= n {
		return minN
	}
	return maxN
}

func bsUpper(arr []int, n int) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] <= n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] > n {
		return minN
	}
	return maxN
}

func bsUpper64(arr []int64, n int64) int {
	var minN, midN, maxN int
	maxN = len(arr)
	for maxN - 1 > minN {
		midN = (minN + maxN) / 2
		if arr[midN] <= n {
			minN = midN
		} else {
			maxN = midN
		}
	}
	if arr[minN] > n {
		return minN
	}
	return maxN
}

func max(n1, n2 int) int {
	if n1 > n2 {
		return n1
	}
	return n2
}

func max64(n1, n2 int64) int64 {
	if n1 > n2 {
		return n1
	}
	return n2
}

func min(n1, n2 int) int {
	if n1 < n2 {
		return n1
	}
	return n2
}

func min64(n1, n2 int64) int64 {
	if n1 < n2 {
		return n1
	}
	return n2
}

func yes(res, isUpperCase bool) bool {
	var arr [4]string = [4]string{"No", "Yes", "NO", "YES"}
	var ind int
	if res == true {
		ind = 1
	}
	if isUpperCase == true {
		ind += 2
	}
	out.WriteString(arr[ind])
	out.WriteByte(NL)
	return res
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	err = bufio.NewWriter(os.Stderr)
)

func main() {
	defer out.Flush()
	//redirectInputToFile(in, "input.txt")

	T := readInt()
	for t := 0; t < T; t++ {
		solve()
	}
}

func solve() {
	n := readInt()
	arr := readArrInt()
	for i := 1; i < n; i++ {
		if arr[i] < arr[i-1] {
			println("YES")
			return
		}
	}
	println("NO")
}

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

func reverse(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

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

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

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func readFloat(in *bufio.Reader) float64 {
	nStr := readStr()
	n, _ := strconv.ParseFloat(nStr, 64)
	return n
}

func readInt() int {
	nStr := readStr()
	n, _ := strconv.Atoi(nStr)
	return n
}

func readStr() string {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	return nStr
}

func readLineNumbs() []string {
	line := readStr()
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt() []int {
	numbs := readLineNumbs()
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrFloat() {
	numbs := readLineNumbs()
	arr := make([]float64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseFloat(n, 64)
		arr[i] = val
	}
}

func readArrInt64() []int64 {
	numbs := readLineNumbs()
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

// PRINT
func print(args ...interface{}) {
	fmt.Fprint(out, args...)
	out.Flush()
}

func println(args ...interface{}) {
	fmt.Fprintln(out, args...)
	out.Flush()
}

func printErr(args ...interface{}) {
	fmt.Fprint(err, args...)
	err.Flush()
}

func printlnErr(args ...interface{}) {
	fmt.Fprintln(err, args...)
	err.Flush()
}

package main

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

/*
3
6
3 5 1 1 5 6
6
1 2 3 2 4 5
6
1 2 2 3 4 5
---
YES
YES
NO
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)

		a := make([]int, n)

		for i := range a {
			scanf("%d", &a[i])
		}
		scanf("\n")

		if sort.IntsAreSorted(a) {
			fmt.Fprintln(writer, "NO")
		} else {
			fmt.Fprintln(writer, "YES")
		}
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int) int {
	quot := num / div
	if num%div != 0 {
		quot++
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	minimum := nums[0]
	for _, num := range nums {
		if num < minimum {
			minimum = num
		}
	}
	return minimum
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	maximum := nums[0]
	for _, num := range nums {
		if num > maximum {
			maximum = num
		}
	}
	return maximum
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Fscan(in, &n)

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

		if sort.IntsAreSorted(arr) {
			fmt.Fprintln(out, "NO")
		} else {
			fmt.Fprintln(out, "YES")
		}
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func flush()                            { out.Flush() }
func scan(a ...interface{})             { fmt.Fscan(in, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(out, f, a...) }
func assert(f bool) {
	if !f {
		panic("gg")
	}
}

// ----------------------------- TEMPLATE END ----------------------------------

func main() {
	defer flush()

	var ntc int
	scan(&ntc)
	for t := 0; t < ntc; t++ {
		var n int
		scan(&n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			scan(&a[i])
		}
		sorted := true
		for i := 1; i < n; i++ {
			sorted = sorted && a[i] >= a[i-1]
		}
		if sorted {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	inputReader := bufio.NewReader(os.Stdin)
	a := ReadLine(inputReader)
	t,err := strconv.Atoi(a)
	if err != nil {
		return
	}
	//fmt.Scanf("%d\n", &t)
	//var answers []string

	for i := 0; i < t; i++ {
		//inputReader := bufio.NewReader(os.Stdin)
		//inputReader2 := bufio.NewReader(os.Stdin)
		b:= ReadLine(inputReader)
		n,err := strconv.Atoi(b)
		if err != nil {
			return
		}
		//var n int
		//fmt.Scanf("%d\n", &n)
		//inputReader := bufio.NewReader(os.Stdin)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			fmt.Println("NO")
			//answers = append(answers, "NO")
		} else {
			fmt.Println("YES")
			//answers = append(answers, "YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}

	}

	//for _, r := range answers {
	//	fmt.Println(r)
	//}

}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++ {
		var n, x int
		Fscan(r, &n)
		flag := false // 是否全部非降
		p := -1
		allEqual := true // 是否全部相等
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			if x < p {
				flag = true
			}
			if p != -1 && x != p {
				allEqual = false
			}
			p = x
		}
		if allEqual {
			Fprintln(w, "NO")
			continue
		}
		if flag {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++{
		var n, x int
		Fscan(r, &n)
		b := false
		p := -1
		be := false
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			if x < p {
				b = true
			}
			if p != -1 && x != p {
				be = true
			}
			p = x
		}
		if !be {
			Fprintln(w, "NO")
			continue
		}
		if b {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++ {
		var n int
		Fscan(r, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			Fscan(r, &a[i])
		}
		mx := make([]int, n)
		mn := make([]int, n)
		mx[0] = a[0]
		mn[n-1] = a[n-1]
		for i := 1; i < n; i++ {
			if a[i] > mx[i-1] {
				mx[i] = a[i]
			} else {
				mx[i] = mx[i-1]
			}
		}
		for i := n - 2; i >= 0; i-- {
			if a[i] < mn[i+1] {
				mn[i] = a[i]
			} else {
				mn[i] = mn[i+1]
			}
		}
		flag := false
		for i := 0; i < n-1; i++ {
			if mx[i] > mn[i+1] {
				flag = true
				break
			}
		}
		if flag {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++{
		var n, x int
		Fscan(r, &n)
		a := make([]int, 0)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			a = append(a, x)
		}
		i := 1
		for ; i < n; i++{
			if a[i] < a[i-1]{
				Fprintln(w, "YES")
				break
			}
		}
		if i == n {
			Fprintln(w, "NO")
		}
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++{
		var n, x int
		Fscan(r, &n)
		b := false
		p := -1
		a := make([]int, 0)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			a = append(a, x)
			if x < p {
				b = true
				//break
			}
			p = x
		}
		sort.Ints(a)
		if len(a) == n && a[0] == a[n-1]{
			Fprintln(w, "NO")
			continue
		}
		if b {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

type CF1637A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1637A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1637A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1637A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1637A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1637A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1637A
Date: 18/02/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1637/A
Problem: CF1637A
**/
func (in *CF1637A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr := make([]int64, n)
		ans := true
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt64()
		}

		for i:=1;i<n;i++{
			if arr[i-1]>arr[i]{
				ans = false
			}
		}
		if !ans {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func NewCF1637A(r *bufio.Reader) *CF1637A {
	return &CF1637A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1637A(bufio.NewReader(os.Stdin)).Run()
}

/*
1
4
999999999 999999999 999999998 1000000000

*/

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	inputReader := bufio.NewReader(os.Stdin)
	a := ReadLine(inputReader)
	t,err := strconv.Atoi(a)
	if err != nil {
		return
	}
	//fmt.Scanf("%d\n", &t)
	//var answers []string

	for i := 0; i < t; i++ {
		//inputReader := bufio.NewReader(os.Stdin)
		inputReader2 := bufio.NewReader(os.Stdin)
		b:= ReadLine(inputReader2)
		n,err := strconv.Atoi(b)
		if err != nil {
			return
		}
		//var n int
		//fmt.Scanf("%d\n", &n)
		inputReader := bufio.NewReader(os.Stdin)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			fmt.Println("NO")
			//answers = append(answers, "NO")
		} else {
			fmt.Println("YES")
			//answers = append(answers, "YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}

	}

	//for _, r := range answers {
	//	fmt.Println(r)
	//}

}

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	inputReader := bufio.NewReader(os.Stdin)
	a := ReadLine(inputReader)
	t,err := strconv.Atoi(a)
	if err != nil {
		return
	}
	//fmt.Scanf("%d\n", &t)
	var answers []string

	for i := 0; i < t; i++ {
		//inputReader := bufio.NewReader(os.Stdin)
		inputReader2 := bufio.NewReader(os.Stdin)
		b:= ReadLine(inputReader2)
		n,err := strconv.Atoi(b)
		if err != nil {
			return
		}
		//var n int
		//fmt.Scanf("%d\n", &n)
		inputReader := bufio.NewReader(os.Stdin)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			answers = append(answers, "NO")
		} else {
			answers = append(answers, "YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}
	}
	for _, r := range answers {
		fmt.Print(r)
	}

}

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	inputReader := bufio.NewReader(os.Stdin)
	a := ReadLine(inputReader)
	t,err := strconv.Atoi(a)
	if err != nil {
		return
	}
	//fmt.Scanf("%d\n", &t)
	var answers []string

	for i := 0; i < t; i++ {
		//inputReader := bufio.NewReader(os.Stdin)
		inputReader2 := bufio.NewReader(os.Stdin)
		b:= ReadLine(inputReader2)
		n,err := strconv.Atoi(b)
		if err != nil {
			return
		}
		//var n int
		//fmt.Scanf("%d\n", &n)
		inputReader := bufio.NewReader(os.Stdin)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			answers = append(answers, "NO")
		} else {
			answers = append(answers, "YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}
	}
	for _, r := range answers {
		fmt.Print(r, " ")
	}

}

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	inputReader := bufio.NewReader(os.Stdin)
	a := ReadLine(inputReader)
	t,err := strconv.Atoi(a)
	if err != nil {
		return
	}
	//fmt.Scanf("%d\n", &t)
	var answers []string

	for i := 0; i < t; i++ {
		//inputReader := bufio.NewReader(os.Stdin)
		inputReader2 := bufio.NewReader(os.Stdin)
		b:= ReadLine(inputReader2)
		n,err := strconv.Atoi(b)
		if err != nil {
			return
		}
		//var n int
		//fmt.Scanf("%d\n", &n)
		inputReader := bufio.NewReader(os.Stdin)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			answers = append(answers, "NO")
		} else {
			answers = append(answers, "YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}
	}
	for _, r := range answers {
		fmt.Print(r, "\n")
	}

}

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	inputReader := bufio.NewReader(os.Stdin)
	a := ReadLine(inputReader)
	t,err := strconv.Atoi(a)
	if err != nil {
		return
	}
	//fmt.Scanf("%d\n", &t)
	var answers []string

	for i := 0; i < t; i++ {
		//inputReader := bufio.NewReader(os.Stdin)
		inputReader2 := bufio.NewReader(os.Stdin)
		b:= ReadLine(inputReader2)
		n,err := strconv.Atoi(b)
		if err != nil {
			return
		}
		//var n int
		//fmt.Scanf("%d\n", &n)
		inputReader := bufio.NewReader(os.Stdin)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}
	}
	for _, r := range answers {
		fmt.Print(r, "\n")
	}

}

package main

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

func ReadLine(inputReader *bufio.Reader) string {
	line, err := inputReader.ReadString('\n')
	if err != nil {
		return ""
	}
	return strings.TrimSpace(string(line))
}

func checkSort(array []int) bool {
	for i := 0; i < len(array)-1; i++ {
		if array[i] > array[i+1] {
			return false
		}
	}
	return true
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	var answers []string

	for i := 0; i < t; i++ {
		inputReader := bufio.NewReader(os.Stdin)
		var n int
		fmt.Scanf("%d\n", &n)
		variables := make([]int, n)
		numbers := ReadLine(inputReader)
		s := strings.Split(numbers, " ")
		for j := 0; j < n; j++ {
			number, err := strconv.Atoi(s[j])
			if err != nil {
				return
			}
			variables = append(variables, number)
		}
		if checkSort(variables) {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
		//sort.Slice(variables, func(i, j int) bool {
		//	return variables[i] > variables[j]
		//})
		//sum := summ(variables)
		//prefixSum := 0
		//countLeft := 0
		//countRight := len(variables)
		//flag := false
		//for _, r := range variables {
		//	if (prefixSum + r > sum - r) && (countLeft+1 < countRight-1) {
		//		flag = true
		//		break
		//	} else {
		//		prefixSum += r
		//		sum -= r
		//		countLeft += 1
		//		countRight -= 1
		//	}
		//}
		//if flag {
		//	answers = append(answers, "YES")
		//} else {
		//	answers = append(answers, "NO")
		//}
	}
	for _, r := range answers {
		fmt.Print(r, "\n")
	}

}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++{
		var n, x int
		Fscan(r, &n)
		b := false
		p := -1
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			if x < p {
				b = true
				break
			}
			p = x
		}
		if b {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++{
		var n, x int
		Fscan(r, &n)
		b := false
		p := -1
		a := make([]int, 0)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			a = append(a, x)
			if x < p {
				b = true
				break
			}
			p = x
		}
		sort.Ints(a)
		if len(a) == n && a[0] == a[n-1]{
			Fprintln(w, "NO")
			continue
		}
		if b {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var T int
	Fscan(r, &T)
	for t := 0; t < T; t++{
		var n, x int
		Fscan(r, &n)
		b := false
		p := -1
		a := make([]int, 0)
		for i := 0; i < n; i++ {
			Fscan(r, &x)
			a = append(a, x)
			if x < p {
				b = true
				break
			}
			p = x
		}
		if len(a) == n && a[0] == a[n-1]{
			Fprintln(w, "NO")
			continue
		}
		if b {
			Fprintln(w, "YES")
		} else {
			Fprintln(w, "NO")
		}
	}
}

package main

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

type CF1637A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1637A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1637A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1637A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1637A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1637A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1637A
Date: 18/02/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1637/A
Problem: CF1637A
**/
func (in *CF1637A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		max := -1
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
			if i == 0 {
				max = arr[i]
			}
			if max < arr[i] {
				max = arr[i]
			}
		}

		countMax := 0
		ans := false
		for i := n - 1; i >= 0; i-- {
			if max == arr[i] {
				countMax++
			}
		}

		for i := n - 1; i >= 0; i-- {
			if arr[i] == max {
				countMax--
			} else {
				if countMax > 0 {
					ans = true
				}
			}
		}

		if ans {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func NewCF1637A(r *bufio.Reader) *CF1637A {
	return &CF1637A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1637A(bufio.NewReader(os.Stdin)).Run()
}

package main

import (
	"fmt"
	"sort"
)

var x int

func main() {
	// fmt.Println("hi")
	// x = 20
	// ok := atomic.AddInt32(&x, 100)
	// fmt.Println(x, ok)
	var t int
	fmt.Scanf("%d", &t)
	for t > 0 {
		var n int
		fmt.Scanf("%d", &n)
		nums := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &nums[i])
		}
		temp := make([]int, n)
		copy(temp, nums)
		sort.Ints(temp)
		res := true
		for i := 0; i < n; i++ {
			if temp[i] != nums[i] {
				res = false
				break
			}
		}
		if res {
			fmt.Println("NO")
		} else {
			fmt.Print("YES")
		}
		t--
	}
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	var v []int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var vi int
		scanf("%d", &vi)
		v = append(v, vi)
	}

	sort.Ints(v)
	//fmt.Println(v)

	c, s := 0, 0
	for i, _ := range v {
		//fmt.Println("i:", i, " === ", c, s, v[i])
		if s < v[i]-1 {
			c++
			s = v[i] - 1
		} else if s < v[i] {
			c++
			s = v[i]
		} else if s < v[i]+1 && v[i] < 150001 {
			c++
			s = v[i] + 1
		}
	}
	fmt.Println(c)
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"sort"
	"strconv"
)

/* solution */

func solve() {

	n := readInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
	}

	sort.Ints(a)

	m := make(map[int]bool, 150002)

	ans := 0
	for i := 0; i < n; i++ {
		w := a[i]
		if w-1 > 0 && m[w-1] == false {
			m[w-1] = true
			ans++
		} else if m[w] == false {
			m[w] = true
			ans++
		} else if m[w+1] == false {
			m[w+1] = true
			ans++
		}
	}

	printInt(ans)

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	scanf("%d\n", &n)
	//var v []int
	v := make([]int, n)
	for i := 0; i < n; i++ {
		var vi int
		scanf("%d", &vi)
		//v = append(v, vi)
		v[i] = vi
	}

	sort.Ints(v)

	c, s := 0, 0
	for i, _ := range v {
		if s < v[i]-1 {
			c++
			s = v[i] - 1
		} else if s < v[i] {
			c++
			s = v[i]
		} else if s < v[i]+1 && v[i] < 150001 {
			c++
			s = v[i] + 1
		}
	}
	printf("%d\n", c)
}

package main
import "fmt"
import "os"
import "bufio"

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

const N = 150005

func main(){
    input := bufio.NewReader(os.Stdin)
    var n int;
    fmt.Fscanf(input, "%d\n", &n)
    cnt := make([]int, N)
    for i:=0; i<n; i++ {
        var x int
        fmt.Fscanf(input, "%d", &x)
        cnt[x]++
    }
    ans := 0
    for i:=1; i<N-1; i++ {
        if cnt[i-1]>=1 {
            cnt[i-1]--; ans++
        } else if cnt[i]>=1 {
            cnt[i]--; ans++
        } else if cnt[i+1]>=1 {
            cnt[i+1]--; ans++
        }
    }
    fmt.Println(ans)
}

package main
import(
	"fmt"
	"bufio"
	"os"
)
func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(in, "%d\n", &n)
	a := make([]int, 150005)
	for i:=0; i<n; i++{
		var x int
		fmt.Fscanf(in, "%d", &x)
		a[x]++
	}
	res := 0
	for i:=1; i<150004; i++{
		if a[i-1]>=1 {
			a[i-1]--
			res++
		} else if a[i]>=1 {
			a[i]--
			res++
		} else if a[i+1]>=1 {
			a[i+1]--
			res++
		}
	}
	fmt.Println(res)
}

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/1203/E

package main

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

func max(x int, y int) int {
	if x > y {
		return x
	}
	return y
}

func Solve(a []int) int {
	sort.Ints(a)
	var stack []int
	for _, elem := range a {
		if len(stack) == 0 {
			stack = append(stack, max(elem-1, 1))
		} else {
			lastElem := stack[len(stack)-1]
			if lastElem == elem {
				stack = append(stack, elem+1)
			} else if lastElem < elem-1 {
				stack = append(stack, elem-1)
			} else if lastElem+1 == elem {
				stack = append(stack, elem)
			}
		}
	}
	return len(stack)
}

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

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}
	fmt.Fprintf(writer, "%d\n", Solve(a))
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	var v []int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var vi int
		scanf("%d", &vi)
		v = append(v, vi)
	}

	sort.Ints(v)

	c := 0
	s := 1
	for i, _ := range v {
		if v[i] == s {
			c++
			s++
		} else if v[i]-1 == s {
			c++
			s++
		} else if v[i]+1 == s {
			c++
			s++
		}
	}
	fmt.Println(c)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var n int
	var v []int
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var vi int
		scanf("%d", &vi)
		v = append(v, vi)
	}

	sort.Ints(v)
	//fmt.Println(v)

	c, s := 0, 0
	for i, _ := range v {
		//fmt.Println("i:", i, " === ", c, s, v[i])
		if s < v[i]-1 {
			c++
			s = v[i] - 1
		} else if s < v[i] {
			c++
			s = v[i]
		} else if s < v[i]+1 && v[i]+1 < 150001 {
			c++
			s = v[i] + 1
		}
	}
	fmt.Println(c)
}


// 137B-mic
package main

import (
    "fmt"
)

func main() {
    var c [5555]bool
    var n int
    var a int
    var j int
    fmt.Scan(&n)
    for i := 1; i <= n; i++ {
        fmt.Scan(&a)
        c[a] = true
    }
    for i := 1; i <= n; i++ {
        if c[i] {
            j += 0
        } else {
            j += 1
        }
    }
    fmt.Println(j)
}

package main
import (
	"fmt"
	//"sort"
)
func main() {
	var n,m int
	c:=0
	fmt.Scan(&n)
	a:=make([]int,5100)
	for i:=0;i<n;i++ {
		fmt.Scan(&m)
		a[m]++
	}
	for i:=1;i<=n;i++ {
		if a[i]==0 {
			c++
		}
	}
	fmt.Println(c)
}

package main

import "fmt"

func main() {
    var n,a int
    var f [5005]bool
    fmt.Scan(&n)
    ans := n
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        if (a <= n) && (!f[a]) { f[a] = true; ans-- }
    }
    fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var N int
	var a int
	var S map[int]bool = make(map[int]bool)

	fmt.Scanf("%d\n", &N)

	for n := 0; n < N; n++ {
		fmt.Scanf("%d", &a)
		S[a] = true
	}

	count := 0
	for i := 1; i <= N; i++ {
		if S[i] == true {
			count++
		}
	}

	fmt.Println(N - count)
}

package main

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

type MyScan struct {
	sc      *bufio.Scanner
	tokens  []string
	current int
}

func NewScan(in io.Reader) *MyScan {
	return &MyScan{sc: bufio.NewScanner(in)}
}

func (s *MyScan) Next() string {
	for s.current >= len(s.tokens) && s.sc.Scan() {
		text := strings.TrimSpace(s.sc.Text())
		s.tokens = strings.Split(text, " ")
		s.current = 0
	}
	next := s.tokens[s.current]
	s.current++
	return next
}
func (s *MyScan) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *MyScan) NextLine() string {
	s.sc.Scan()
	return s.sc.Text()
}

func main() {
	s := NewScan(os.Stdin)
	n := s.NextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.NextInt()
	}
	b := make([]bool, 5001)
	for _, v := range a {
		b[v] = true
	}
	ans := 0
	for i := 1; i < n+1; i++ {
		if !b[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"
//import "sort"

func main(){
	var n int
	fmt.Scan(&n)
	var aa int
	a := make([]int, 5000)
	for i:=0; i<n; i++ {
		fmt.Scan(&aa)
		a[aa-1] = aa
	}
	tot := 0
//	sort.Sort(a)
	for j:=0; j<n; j++ {
		if a[j] == 0 {
			tot +=1
		} else {
			tot = tot
		}
	}
	fmt.Println(tot)
}

package main

import "fmt"
//import "sort"

func main(){
	var n int
	fmt.Scan(&n)
	var aa int
	a := make([]int, 5000)
	for i:=0; i<n; i++ {
		fmt.Scan(&aa)
		a[aa-1] = aa
	}
	tot := 0
//	sort.Ints(a)
	for j:=0; j<n; j++ {
		if a[j] == 0 {
			tot +=1
		} else {
			tot = tot
		}
	}
	fmt.Println(tot)
}

package main

import "fmt"

func main() {
    var n int
    var a [5005]int
    var f [5005]bool
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
        f[a[i]] = true
    }
    ans := n
    for i := 0; i < n; i++ {
        cnt := 0
        for j := a[i]; j < (a[i]+n); j++ {
            if !f[j] { cnt++ }
        }
        if ans > cnt { ans = cnt }
    }
    fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var N int
	var a int
	var S map[int]bool = make(map[int]bool)

	fmt.Scanf("%d\n", &N)

	for n := 0; n < N; n++ {
		fmt.Scanf("%d", &a)
		S[a] = true
	}

	count := 0
	for _, v := range S {
		if v == true {
			count++
		}
	}
	fmt.Println(N - count)

}

package main

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

type MyScan struct {
	sc      *bufio.Scanner
	tokens  []string
	current int
}

func NewScan(in io.Reader) *MyScan {
	return &MyScan{sc: bufio.NewScanner(in)}
}

func (s *MyScan) Next() string {
	for s.current >= len(s.tokens) && s.sc.Scan() {
		text := strings.TrimSpace(s.sc.Text())
		s.tokens = strings.Split(text, " ")
		s.current = 0
	}
	next := s.tokens[s.current]
	s.current++
	return next
}
func (s *MyScan) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *MyScan) NextLine() string {
	s.sc.Scan()
	return s.sc.Text()
}

func main() {
	fmt.Println("hello worlds")
	s := NewScan(os.Stdin)
	n := s.NextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.NextInt()
	}
	b := make([]bool, 5001)
	for _, v := range a {
		b[v] = true
	}
	ans := 0
	for i := 1; i < n+1; i++ {
		if !b[i] {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		fmt.Println(sc.Bytes())
	}
}

// 137B-mic
package main

import (
    "fmt"
)

func main() {
    var s string
    var k, l, m, n int
    k = 1
    fmt.Scan(&s)
    for i := 1; i < len(s); i++ {
        if s[i] != s[i-1] {
            k++
            l = 0
        } else {
            l++
        }
        if l == 5 {
            m++

            l = 0
        }
    }
    n = k + m
    fmt.Println(n)
}