QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#881340#10052. Just Long Neckties 2cmk666100 ✓536ms1047836kbC++2311.1kb2025-02-04 15:01:362025-02-04 15:01:42

Judging History

This is the latest submission verdict.

  • [2025-02-04 15:01:42]
  • Judged
  • Verdict: 100
  • Time: 536ms
  • Memory: 1047836kb
  • [2025-02-04 15:01:36]
  • Submitted

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2025-02-02 20:50:43]
[Last Modified Time: 2025-02-02 21:42:16] */
#ifdef LOCAL
#include<bits/stdc++.h>
#include"debug.h"
#else
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
#define USE_FastIO
// ------------------------------
// #define DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
	inline void _chk_i() {}
	inline char _gc_nochk() { return getchar(); }
	inline char _gc() { return getchar(); }
	inline void _chk_o() {}
	inline void _pc_nochk(char c) { putchar(c); }
	inline void _pc(char c) { putchar(c); }
	template < int n > inline void _pnc_nochk(const char *c) { for ( int i = 0 ; i < n ; i++ ) putchar(c[i]); }
#else
#ifdef DISABLE_MMAP
	inline constexpr int _READ_SIZE = 1 << 18; inline static char _read_buffer[_READ_SIZE + 40], *_read_ptr = nullptr, *_read_ptr_end = nullptr; static inline bool _eof = false;
	inline void _chk_i() { if ( __builtin_expect(!_eof, true) && __builtin_expect(_read_ptr_end - _read_ptr < 40, false) ) { int sz = _read_ptr_end - _read_ptr; if ( sz ) memcpy(_read_buffer, _read_ptr, sz); char *beg = _read_buffer + sz; _read_ptr = _read_buffer, _read_ptr_end = beg + fread(beg, 1, _READ_SIZE, stdin); if ( __builtin_expect(_read_ptr_end != beg + _READ_SIZE, false) ) _eof = true, *_read_ptr_end = EOF; } }
	inline char _gc_nochk() { return __builtin_expect(_eof && _read_ptr == _read_ptr_end, false) ? EOF : *_read_ptr++; }
	inline char _gc() { _chk_i(); return _gc_nochk(); }
#else
#include<sys/mman.h>
#include<sys/stat.h>
	inline static char *_read_ptr = (char *)mmap(nullptr, [] { struct stat s; return fstat(0, &s), s.st_size; } (), 1, 2, 0, 0);
	inline void _chk_i() {}
	inline char _gc_nochk() { return *_read_ptr++; }
	inline char _gc() { return *_read_ptr++; }
#endif
	inline constexpr int _WRITE_SIZE = 1 << 18; inline static char _write_buffer[_WRITE_SIZE + 40], *_write_ptr = _write_buffer;
	inline void _chk_o() { if ( __builtin_expect(_write_ptr - _write_buffer > _WRITE_SIZE, false) ) fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer; }
	inline void _pc_nochk(char c) { *_write_ptr++ = c; }
	inline void _pc(char c) { *_write_ptr++ = c, _chk_o(); }
	template < int n > inline void _pnc_nochk(const char *c) { memcpy(_write_ptr, c, n), _write_ptr += n; }
	inline struct _auto_flush { inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); } } _auto_flush;
#endif
#define println println_ // don't use C++23 std::println
	template < class T > inline constexpr bool _is_signed = numeric_limits < T >::is_signed;
	template < class T > inline constexpr bool _is_unsigned = numeric_limits < T >::is_integer && !_is_signed < T >;
#if __SIZEOF_LONG__ == 64
	template <> inline constexpr bool _is_signed < __int128 > = true;
	template <> inline constexpr bool _is_unsigned < __uint128_t > = true;
#endif
	inline bool _isgraph(char c) { return c >= 33; }
	inline bool _isdigit(char c) { return 48 <= c && c <= 57; } // or faster, remove c <= 57
	constexpr struct _table {
#ifndef LOCAL
	int i[65536];
#endif
	char o[40000]; constexpr _table() :
#ifndef LOCAL
	i{},
#endif
	o{} {
#ifndef LOCAL
	for ( int x = 0 ; x < 65536 ; x++ ) i[x] = -1; for ( int x = 0 ; x <= 9 ; x++ ) for ( int y = 0 ; y <= 9 ; y++ ) i[x + y * 256 + 12336] = x * 10 + y;
#endif
	for ( int x = 0 ; x < 10000 ; x++ ) for ( int y = 3, z = x ; ~y ; y-- ) o[x * 4 + y] = z % 10 + 48, z /= 10; } } _table;
	template < class T, int digit > inline constexpr T _pw10 = 10 * _pw10 < T, digit - 1 >;
	template < class T > inline constexpr T _pw10 < T, 0 > = 1;
	inline void read(char &c) { do c = _gc(); while ( !_isgraph(c) ); }
	inline void read_cstr(char *s) { char c = _gc(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) *s++ = c, c = _gc(); *s = 0; }
	inline void read(string &s) { char c = _gc(); s.clear(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) s.push_back(c), c = _gc(); }
	template < class T, bool neg >
#ifndef LOCAL
	__attribute__((no_sanitize("undefined")))
#endif
	inline void _read_int_suf(T &x) { _chk_i(); char c; while
#ifndef LOCAL
	( ~_table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)] ) if constexpr ( neg ) x = x * 100 - _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; else x = x * 100 + _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; if
#endif
	( _isdigit(c = _gc_nochk()) ) if constexpr ( neg ) x = x * 10 - ( c & 15 ); else x = x * 10 + ( c & 15 ); }
	template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ) if ( c == 45 ) { _read_int_suf < T, true >(x = -( _gc_nochk() & 15 )); return; } _read_int_suf < T, false >(x = c & 15); }
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ); _read_int_suf < T, false >(x = c & 15); }
	inline void write(bool x) { _pc(x | 48); }
	inline void write(char c) { _pc(c); }
	inline void write_cstr(const char *s) { while ( *s ) _pc(*s++); }
	inline void write(const string &s) { for ( char c : s ) _pc(c); }
	template < class T, bool neg, int digit > inline void _write_int_suf(T x) { if constexpr ( digit == 4 ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _write_int_suf < T, neg, digit / 2 >(x / _pw10 < T, digit / 2 >), _write_int_suf < T, neg, digit / 2 >(x % _pw10 < T, digit / 2 >); }
	template < class T, bool neg, int digit > inline void _write_int_pre(T x) { if constexpr ( digit <= 4 ) if ( digit >= 3 && ( neg ? x <= -100 : x >= 100 ) ) if ( digit >= 4 && ( neg ? x <= -1000 : x >= 1000 ) ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _pnc_nochk < 3 >(_table.o + ( neg ? -x : x ) * 4 + 1); else if ( digit >= 2 && ( neg ? x <= -10 : x >= 10 ) ) _pnc_nochk < 2 >(_table.o + ( neg ? -x : x ) * 4 + 2); else _pc_nochk(( neg ? -x : x ) | 48); else { constexpr int cur = 1 << __lg(digit - 1); if ( neg ? x <= -_pw10 < T, cur > : x >= _pw10 < T, cur > ) _write_int_pre < T, neg, digit - cur >(x / _pw10 < T, cur >), _write_int_suf < T, neg, cur >(x % _pw10 < T, cur >); else _write_int_pre < T, neg, cur >(x); } }
	template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void write(T x) { if ( x >= 0 ) _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x); else _pc_nochk(45), _write_int_pre < T, true, numeric_limits < T >::digits10 + 1 >(x); _chk_o(); }
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void write(T x) { _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x), _chk_o(); }
	template < size_t N, class ...T > inline void _read_tuple(tuple < T... > &x) { read(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _read_tuple < N + 1, T... >(x); }
	template < size_t N, class ...T > inline void _write_tuple(const tuple < T... > &x) { write(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _pc(32), _write_tuple < N + 1, T... >(x); }
	template < class ...T > inline void read(tuple < T... > &x) { _read_tuple < 0, T... >(x); }
	template < class ...T > inline void write(const tuple < T... > &x) { _write_tuple < 0, T... >(x); }
	template < class T1, class T2 > inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
	template < class T1, class T2 > inline void write(const pair < T1, T2 > &x) { write(x.first), _pc(32), write(x.second); }
	template < class T > inline auto read(T &x) -> decltype(x.read(), void()) { x.read(); }
	template < class T > inline auto write(const T &x) -> decltype(x.write(), void()) { x.write(); }
	template < class T1, class ...T2 > inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
	template < class ...T > inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
	template < class T1, class ...T2 > inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
	template < class ...T > inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
	template < class T > inline void print(const T &x) { write(x); }
	inline void print_cstr(const char *x) { write_cstr(x); }
	template < class T1, class ...T2 > inline void print(const T1 &x, const T2 &...y) { write(x), _pc(32), print(y...); }
	template < class ...T > inline void print_cstr(const char *x, const T *...y) { write_cstr(x), _pc(32), print_cstr(y...); }
	inline void println() { _pc(10); }
	inline void println_cstr() { _pc(10); }
	template < class ...T > inline void println(const T &...x) { print(x...), _pc(10); }
	template < class ...T > inline void println_cstr(const T *...x) { print_cstr(x...), _pc(10); }
}	using FastIO::read, FastIO::read_cstr, FastIO::write, FastIO::write_cstr, FastIO::println, FastIO::println_cstr;
using B = bitset < 231 >;
int n, m, al, a[5000009], id[21][21], pre[5000009][21], dp[1 << 21], ko, o, pos, ans;
B msk[1 << 21];
namespace ST
{
	B t[5000009 << 2];
	inline int lc(int p) { return p << 1; }
	inline int rc(int p) { return p << 1 | 1; }
	inline int md(int l, int r) { return ( l + r ) >> 1; }
	inline void build(int p, int l, int r)
	{
		if ( l == r ) { t[p].set(id[a[l + 1]][a[l + 2]]); return; }
		build(lc(p), l, md(l, r)), build(rc(p), md(l, r) + 1, r), t[p] = t[lc(p)] | t[rc(p)];
	}
	inline int fnd(int p, int l, int r, int o, const B &msk)
	{
		if ( r < o || ( t[p] & msk ).none() ) return -1;
		if ( l == r ) return l;
		int z = fnd(lc(p), l, md(l, r), o, msk);
		return ~z ? z : fnd(rc(p), md(l, r) + 1, r, o, msk);
	}
}
int main()
{
	read(n);
	For(i, 1, n) read(a[i]), m = max(m, a[i]--);
	For(i, 1, n) copy(pre[i - 1], pre[i - 1] + 21, pre[i]), pre[i][a[i]] = i;
	For(i, 0, m - 1) For(j, i, m - 1) id[i][j] = id[j][i] = o++;
	ans = m, al = ( 1 << m ) - 1, ST::build(1, 0, n - 2);
	For(i, 1, al)
	{
		o = __builtin_ctz(i), msk[i] = msk[i ^ ( 1 << o )];
		For(j, 0, m - 1) if ( i & ( 1 << j ) ) msk[i].set(id[o][j]);
	}
	For(i, 0, al)
	{
		o = ST::fnd(1, 0, n - 2, dp[i], msk[i ^ al]), dp[i] = ~o ? o : n, ko = 0;
		For(j, 0, m - 1)
		{
			if ( i & ( 1 << j ) ) { ko = 1 << j; continue; }
			pos = pre[min(n, dp[i] + 2)][j];
			if ( pos ) o = ( i ^ ko ) | ( 1 << j ), dp[o] = max(dp[o], pos);
		}
	}
	For(i, 0, al) if ( dp[i] >= n - 1 ) ans = min(ans, __builtin_popcount(i));
	return println(ans), 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 130ms
memory: 43676kb

input:

15
2 19 3 6 1 18 20 9 17 19 18 4 15 7 16

output:

3

result:

ok single line: '3'

Test #2:

score: 10
Accepted
time: 135ms
memory: 44180kb

input:

15
13 6 13 10 3 6 18 8 20 14 11 15 12 12 15

output:

2

result:

ok single line: '2'

Test #3:

score: 10
Accepted
time: 33ms
memory: 16116kb

input:

15
3 6 7 9 10 6 12 13 5 13 14 16 17 6 18

output:

1

result:

ok single line: '1'

Test #4:

score: 10
Accepted
time: 130ms
memory: 43468kb

input:

13
14 2 12 4 16 5 7 7 19 8 5 8 20

output:

1

result:

ok single line: '1'

Test #5:

score: 10
Accepted
time: 281ms
memory: 79332kb

input:

15
6 14 13 5 17 16 15 6 20 17 9 21 10 4 20

output:

2

result:

ok single line: '2'

Test #6:

score: 10
Accepted
time: 284ms
memory: 81504kb

input:

15
21 21 21 14 13 16 15 14 7 6 5 3 7 5 1

output:

4

result:

ok single line: '4'

Test #7:

score: 10
Accepted
time: 287ms
memory: 79328kb

input:

15
5 15 16 17 21 21 21 21 21 13 21 21 21 1 21

output:

1

result:

ok single line: '1'

Test #8:

score: 10
Accepted
time: 0ms
memory: 8396kb

input:

15
8 8 8 8 8 8 8 8 8 8 8 8 8 8 14

output:

1

result:

ok single line: '1'

Test #9:

score: 10
Accepted
time: 18ms
memory: 14296kb

input:

15
17 17 17 6 6 17 17 17 6 17 6 17 6 6 17

output:

2

result:

ok single line: '2'

Test #10:

score: 10
Accepted
time: 4ms
memory: 8168kb

input:

15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

output:

1

result:

ok single line: '1'

Test #11:

score: 10
Accepted
time: 281ms
memory: 81620kb

input:

15
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7

output:

7

result:

ok single line: '7'

Test #12:

score: 10
Accepted
time: 0ms
memory: 5840kb

input:

15
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8

output:

1

result:

ok single line: '1'

Test #13:

score: 10
Accepted
time: 279ms
memory: 81576kb

input:

15
21 21 20 20 19 19 18 18 17 17 16 16 15 15 14

output:

7

result:

ok single line: '7'

Test #14:

score: 10
Accepted
time: 269ms
memory: 79560kb

input:

2
21 21

output:

1

result:

ok single line: '1'

Test #15:

score: 10
Accepted
time: 269ms
memory: 79388kb

input:

15
21 21 21 21 21 21 21 21 21 21 21 21 21 21 21

output:

1

result:

ok single line: '1'

Test #16:

score: 10
Accepted
time: 276ms
memory: 81336kb

input:

15
21 9 10 16 4 4 10 20 5 2 4 1 11 16 9

output:

3

result:

ok single line: '3'

Test #17:

score: 10
Accepted
time: 137ms
memory: 43628kb

input:

15
14 9 8 19 5 19 8 9 3 2 20 16 10 16 15

output:

3

result:

ok single line: '3'

Test #18:

score: 10
Accepted
time: 0ms
memory: 5968kb

input:

2
1 1

output:

1

result:

ok single line: '1'

Subtask #2:

score: 6
Accepted

Test #19:

score: 6
Accepted
time: 0ms
memory: 5840kb

input:

500
1 1 2 2 2 2 2 1 2 2 1 1 1 1 2 1 1 2 1 2 1 2 1 1 2 2 2 2 1 1 1 2 2 1 1 1 2 1 1 1 1 1 2 1 2 2 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 1 1 1 2 2 1 2 1 1 2 1 2 2 1 1 1 2 1 2 1 1 2 2 2 1 2 2 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 2 2 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 2 2 1 1 ...

output:

2

result:

ok single line: '2'

Test #20:

score: 6
Accepted
time: 0ms
memory: 5840kb

input:

500
1 2 1 1 2 2 1 2 1 1 2 1 2 1 1 1 1 2 2 1 1 2 2 2 1 1 1 1 2 2 1 2 1 2 2 2 1 1 2 2 2 1 1 1 1 2 1 1 2 1 1 2 2 1 2 2 1 1 1 1 2 2 2 2 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 1 2 2 1 1 1 2 1 2 1 2 1 2 1 1 1 2 2 1 1 1 1 2 2 2 2 1 1 1 1 1 2 1 2 2 2 2 1 2 1 2 2 1 1 1 2 2 1 1 1 2 2 1 2 2 2 1 1 1 2 2 1 1 2 2 2 2 1 1 ...

output:

2

result:

ok single line: '2'

Test #21:

score: 6
Accepted
time: 0ms
memory: 5716kb

input:

500
2 1 2 2 2 2 2 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 2 2 1 2 2 1 2 1 2 2 2 2 2 1 2 1 2 1 2 1 2 2 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 2 1 2 1 2 2 1 2 2 1 2 2 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 1 2 2 2 2 1 2 ...

output:

1

result:

ok single line: '1'

Test #22:

score: 6
Accepted
time: 0ms
memory: 5676kb

input:

500
2 1 2 1 2 1 1 2 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 2 1 1 2 1 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 1 1 1 2 1 1 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 ...

output:

1

result:

ok single line: '1'

Test #23:

score: 6
Accepted
time: 0ms
memory: 5836kb

input:

500
2 1 1 2 1 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 2 1 2 1 1 2 1 2 1 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 2 ...

output:

1

result:

ok single line: '1'

Test #24:

score: 6
Accepted
time: 0ms
memory: 9980kb

input:

500
2 1 2 1 2 1 2 1 1 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 1 1 2 1 2 1 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1 1 1 ...

output:

1

result:

ok single line: '1'

Test #25:

score: 6
Accepted
time: 0ms
memory: 5800kb

input:

500
1 2 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 ...

output:

1

result:

ok single line: '1'

Test #26:

score: 6
Accepted
time: 1ms
memory: 5968kb

input:

2
1 2

output:

1

result:

ok single line: '1'

Test #27:

score: 6
Accepted
time: 0ms
memory: 7884kb

input:

2
2 1

output:

1

result:

ok single line: '1'

Test #28:

score: 6
Accepted
time: 1ms
memory: 5840kb

input:

4
1 1 2 2

output:

1

result:

ok single line: '1'

Test #29:

score: 6
Accepted
time: 0ms
memory: 5840kb

input:

4
2 2 1 1

output:

2

result:

ok single line: '2'

Test #30:

score: 6
Accepted
time: 0ms
memory: 8012kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1

result:

ok single line: '1'

Test #31:

score: 6
Accepted
time: 0ms
memory: 5840kb

input:

500
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

2

result:

ok single line: '2'

Test #32:

score: 6
Accepted
time: 1ms
memory: 5844kb

input:

2
2 2

output:

1

result:

ok single line: '1'

Test #33:

score: 6
Accepted
time: 0ms
memory: 7760kb

input:

500
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1

result:

ok single line: '1'

Subtask #3:

score: 12
Accepted

Test #34:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

500
2 5 4 4 4 1 1 4 5 1 1 2 2 1 4 3 3 1 4 5 4 3 1 1 3 4 4 2 2 3 1 1 1 1 3 3 5 2 1 2 1 1 4 1 4 4 1 2 2 5 3 4 2 3 2 3 5 3 3 1 5 3 4 5 1 2 5 5 2 1 5 1 4 2 2 2 1 2 1 2 2 1 4 2 3 5 1 2 5 2 1 2 5 3 3 5 3 1 3 4 3 3 1 3 4 4 5 1 2 2 2 3 2 5 3 5 3 1 4 5 1 1 5 3 3 5 4 3 1 5 1 5 5 1 5 5 2 4 3 2 5 3 3 2 4 3 1 3 ...

output:

5

result:

ok single line: '5'

Test #35:

score: 12
Accepted
time: 1ms
memory: 5840kb

input:

500
4 5 3 3 2 5 3 2 4 3 5 4 1 5 2 2 2 4 2 1 5 5 5 1 1 2 3 1 4 4 2 3 3 3 1 4 4 1 2 1 1 1 4 2 3 1 4 1 3 3 5 4 5 2 3 5 1 5 1 2 2 5 2 2 5 1 4 2 4 2 2 1 4 5 3 2 2 2 2 2 3 1 1 5 2 4 2 4 2 2 3 2 5 3 2 1 2 5 5 2 3 1 4 5 1 4 4 4 1 3 4 1 1 3 2 5 1 4 4 2 3 1 5 5 4 2 4 1 4 3 2 1 3 4 4 3 1 3 2 5 3 3 5 5 4 4 4 5 ...

output:

5

result:

ok single line: '5'

Test #36:

score: 12
Accepted
time: 0ms
memory: 5844kb

input:

500
1 1 4 1 1 3 1 1 3 1 5 1 1 1 5 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 3 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 3 1 1 1 1 4 1 1 2 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 4 1 3 1 1 1 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 2 2 1 2 2 2 2 2 2 5 2 2 1 2 3 2 2 1 2 2 2 2 2 5 2 2 1 ...

output:

1

result:

ok single line: '1'

Test #37:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

499
4 1 1 1 2 1 3 1 2 1 2 1 1 1 4 1 2 1 5 1 3 1 1 1 4 1 5 1 5 1 5 1 1 1 3 1 4 1 5 1 2 1 3 1 1 1 1 1 2 1 3 1 3 1 1 1 2 1 2 1 5 1 3 1 4 1 1 1 3 1 2 1 4 1 1 1 3 1 5 1 1 1 5 1 4 1 2 1 5 1 4 1 4 1 3 1 4 1 3 1 5 1 2 1 1 2 5 2 4 2 4 2 1 2 1 2 3 2 1 2 4 2 2 2 4 2 3 2 5 2 3 2 5 2 1 2 5 2 4 2 2 2 5 2 5 2 2 2 ...

output:

1

result:

ok single line: '1'

Test #38:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

500
1 1 2 1 1 1 3 1 1 1 4 1 3 1 1 1 1 1 1 3 1 2 1 1 4 1 1 5 1 1 1 2 1 1 1 5 1 4 1 5 1 1 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 4 1 5 1 3 1 4 1 1 1 1 1 1 1 5 1 1 5 2 3 1 4 1 1 1 1 1 1 2 1 2 2 1 2 3 2 4 2 2 2 4 2 2 2 1 3 2 2 1 5 1 5 2 2 2 2 5 2 4 2 4 1 5 1 1 1 2 4 2 4 2 5 1 1 2 2 1 2 5 2 3 2 4 2 2 5 2 2 2 3 2 ...

output:

3

result:

ok single line: '3'

Test #39:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

500
5 4 5 5 5 5 5 5 4 4 5 5 4 5 4 4 5 5 5 5 5 5 5 5 5 4 5 5 5 4 5 5 4 5 4 5 4 4 5 5 5 4 5 4 5 5 5 4 5 5 5 4 5 5 5 5 4 5 4 4 4 5 4 5 5 5 5 5 4 5 5 5 5 5 5 5 4 5 4 4 4 4 5 5 5 5 5 4 5 4 5 5 4 5 5 5 5 5 4 5 5 5 3 3 3 3 5 5 3 5 3 4 3 4 4 3 4 3 5 5 5 4 3 4 4 4 5 3 3 4 4 5 3 5 3 5 3 4 4 5 5 3 5 4 3 3 5 4 ...

output:

5

result:

ok single line: '5'

Test #40:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

500
4 4 1 4 5 4 4 4 2 4 4 4 3 5 5 5 5 4 4 1 1 1 5 3 5 4 4 5 4 4 5 2 4 2 1 1 4 2 5 2 4 4 5 4 1 4 5 4 4 4 4 4 4 4 2 4 5 1 2 5 1 2 4 5 3 3 1 3 4 3 4 1 3 2 2 4 4 3 4 2 1 5 2 3 4 4 4 4 5 3 4 5 5 1 4 1 4 1 4 4 4 2 4 3 2 3 5 1 4 3 1 4 1 3 4 5 2 4 2 1 3 4 1 4 4 4 1 4 2 4 4 5 2 4 5 4 5 4 4 4 4 4 2 4 5 4 4 2 ...

output:

5

result:

ok single line: '5'

Test #41:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

500
1 4 1 1 1 1 1 1 1 1 1 3 1 1 1 3 1 1 1 1 1 1 3 1 1 4 1 1 1 2 4 1 3 1 5 1 1 1 1 1 2 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 3 2 1 5 5 1 2 1 1 1 4 1 1 1 1 1 1 5 5 1 1 1 1 5 2 1 1 2 5 3 1 1 1 1 3 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 2 1 3 1 2 1 1 1 1 1 1 1 3 4 3 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 3 1 1 1 ...

output:

4

result:

ok single line: '4'

Test #42:

score: 12
Accepted
time: 0ms
memory: 5844kb

input:

500
5 5 5 1 1 2 5 5 1 5 5 1 1 5 1 5 5 1 5 1 5 1 1 1 3 5 1 1 1 5 5 1 5 5 4 5 3 1 1 1 5 1 5 5 3 1 1 1 5 1 5 1 2 5 5 5 3 5 1 1 1 5 1 1 1 5 1 5 1 3 4 5 5 1 5 1 1 5 2 1 5 1 1 3 5 5 5 1 5 1 5 1 1 1 4 1 1 5 1 1 1 1 1 5 1 5 5 5 5 1 1 5 1 5 1 5 1 5 1 1 5 5 1 1 1 5 3 5 1 1 5 1 1 5 1 5 1 1 5 5 5 1 1 1 5 5 1 1 ...

output:

4

result:

ok single line: '4'

Test #43:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

5
1 2 3 4 5

output:

1

result:

ok single line: '1'

Test #44:

score: 12
Accepted
time: 1ms
memory: 5844kb

input:

5
5 4 3 2 1

output:

2

result:

ok single line: '2'

Test #45:

score: 12
Accepted
time: 0ms
memory: 5716kb

input:

10
1 1 2 2 3 3 4 4 5 5

output:

1

result:

ok single line: '1'

Test #46:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

10
5 5 4 4 3 3 2 2 1 1

output:

5

result:

ok single line: '5'

Test #47:

score: 12
Accepted
time: 1ms
memory: 5620kb

input:

500
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1

result:

ok single line: '1'

Test #48:

score: 12
Accepted
time: 0ms
memory: 5836kb

input:

500
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

output:

5

result:

ok single line: '5'

Test #49:

score: 12
Accepted
time: 0ms
memory: 5836kb

input:

2
5 5

output:

1

result:

ok single line: '1'

Test #50:

score: 12
Accepted
time: 0ms
memory: 5836kb

input:

500
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

output:

1

result:

ok single line: '1'

Test #51:

score: 12
Accepted
time: 1ms
memory: 7884kb

input:

500
1 1 3 1 3 1 3 1 3 1 2 1 2 1 5 1 3 1 4 1 2 1 3 2 5 1 2 2 4 2 3 1 2 1 1 1 3 1 5 1 1 1 4 1 5 1 4 1 5 2 3 1 3 1 1 1 3 2 5 2 5 1 1 1 1 1 2 4 2 4 3 5 1 3 2 4 2 3 2 3 2 3 1 3 1 2 2 2 1 2 3 1 2 5 1 2 2 1 2 3 2 3 1 3 2 2 3 1 2 5 2 4 1 2 2 4 2 3 1 3 3 1 2 3 1 2 2 4 2 1 2 3 2 5 3 1 3 4 4 2 3 3 3 5 2 5 3 4 ...

output:

4

result:

ok single line: '4'

Test #52:

score: 12
Accepted
time: 0ms
memory: 5840kb

input:

500
1 1 1 1 2 1 5 1 4 1 1 1 1 1 4 1 2 1 5 1 5 1 2 1 1 1 2 1 4 2 1 1 4 1 2 1 3 1 2 1 2 1 1 2 5 1 5 2 2 1 3 1 3 1 3 1 1 1 1 1 4 1 1 1 4 1 2 1 3 1 1 1 1 1 1 2 4 2 1 2 4 2 5 1 5 1 5 1 2 1 5 1 5 1 1 1 2 1 4 1 5 2 4 1 1 1 3 2 4 1 3 1 4 1 2 2 2 2 2 1 4 2 1 2 1 2 2 3 1 4 4 2 3 3 4 2 2 3 5 2 5 2 1 2 1 2 4 1 ...

output:

4

result:

ok single line: '4'

Subtask #4:

score: 18
Accepted

Test #53:

score: 18
Accepted
time: 2ms
memory: 6988kb

input:

500
2 1 12 3 13 13 7 9 7 3 14 10 9 13 6 3 9 1 10 10 7 13 6 9 10 13 3 7 15 12 14 4 1 5 4 3 8 7 3 14 5 1 6 13 1 3 4 10 5 8 3 6 2 4 10 1 13 5 6 13 12 10 14 15 8 9 13 10 9 14 4 9 13 12 4 7 12 4 2 14 6 12 5 4 6 12 13 6 2 12 10 5 6 5 1 1 5 1 5 12 11 3 6 13 11 10 1 8 14 9 5 5 15 1 15 3 15 10 4 6 9 14 1 5 1...

output:

10

result:

ok single line: '10'

Test #54:

score: 18
Accepted
time: 4ms
memory: 8736kb

input:

500
13 14 8 6 9 11 5 12 9 13 10 11 2 3 7 15 12 1 11 3 1 10 15 6 4 9 2 10 3 5 3 14 4 12 11 11 4 7 8 4 13 10 6 2 11 15 2 10 12 4 13 5 2 5 2 15 3 14 9 7 1 6 12 15 10 5 6 5 4 7 13 1 12 15 2 15 11 10 15 8 5 12 2 14 11 4 1 12 5 10 13 14 10 10 7 12 10 8 11 13 12 2 11 10 1 14 1 10 6 13 13 7 5 14 3 8 4 10 6 ...

output:

11

result:

ok single line: '11'

Test #55:

score: 18
Accepted
time: 4ms
memory: 8856kb

input:

500
1 7 1 1 1 9 1 8 1 13 1 1 8 1 1 6 1 1 10 1 7 1 1 1 1 15 1 2 1 8 1 2 1 2 2 2 8 2 4 2 2 2 2 6 2 2 2 2 2 2 2 2 2 10 2 2 2 2 2 14 2 2 2 2 9 2 2 6 2 3 3 11 3 3 10 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 9 3 12 3 1 4 7 4 4 4 4 4 6 4 4 4 12 4 4 5 4 4 4 4 4 4 4 4 4 4 13 4 5 4 5 ...

output:

1

result:

ok single line: '1'

Test #56:

score: 18
Accepted
time: 2ms
memory: 6860kb

input:

499
9 1 6 1 14 1 8 1 4 1 15 1 11 1 7 1 12 1 2 1 4 1 6 1 2 1 15 1 1 1 5 1 13 1 5 1 2 1 15 1 5 2 5 2 9 2 15 2 2 2 3 2 5 2 13 2 9 2 7 2 13 2 11 2 11 3 13 3 15 3 1 3 8 3 1 3 12 3 3 3 12 3 14 3 6 3 9 3 1 3 14 3 8 4 11 4 3 4 5 4 15 4 9 4 9 4 13 4 4 4 8 4 4 4 1 4 6 4 3 4 13 4 14 4 1 4 15 5 7 5 2 5 12 5 15 ...

output:

1

result:

ok single line: '1'

Test #57:

score: 18
Accepted
time: 2ms
memory: 8716kb

input:

500
6 1 7 1 1 2 2 10 2 1 1 1 14 2 9 1 1 12 2 8 2 1 1 14 3 5 1 2 2 12 3 8 1 1 3 3 2 13 4 2 1 11 1 13 2 1 4 3 2 2 12 1 2 12 3 12 2 4 10 1 10 2 9 2 11 2 2 2 9 2 1 2 4 3 15 2 3 14 3 2 2 7 4 3 11 2 9 3 9 3 4 13 3 7 3 11 3 3 4 6 5 3 5 15 3 3 4 3 2 4 4 4 3 4 14 4 6 3 4 5 5 4 4 4 3 5 6 4 6 5 4 6 5 15 5 11 4...

output:

4

result:

ok single line: '4'

Test #58:

score: 18
Accepted
time: 5ms
memory: 6992kb

input:

500
4 10 1 3 2 3 12 1 6 4 5 2 1 3 2 11 7 11 1 2 2 13 2 2 4 3 5 4 5 1 6 4 6 1 10 4 2 4 1 15 6 5 5 8 7 1 1 1 7 6 9 4 9 7 8 11 2 15 13 1 1 1 5 9 4 7 3 7 6 6 6 4 11 1 3 7 5 6 9 15 3 6 1 8 15 4 9 7 7 1 2 3 2 4 4 3 9 1 4 8 10 9 4 7 11 2 1 1 9 1 2 1 10 3 6 7 14 2 1 1 1 2 5 4 2 4 7 8 8 2 9 9 8 4 4 14 6 9 1 ...

output:

8

result:

ok single line: '8'

Test #59:

score: 18
Accepted
time: 4ms
memory: 10120kb

input:

500
12 14 3 10 7 6 9 5 3 5 4 3 11 4 5 2 4 11 11 2 10 1 2 5 4 9 12 9 10 8 2 6 3 2 5 6 8 8 5 6 8 4 15 5 2 13 2 6 7 4 6 6 8 3 7 5 12 4 9 2 14 8 11 4 11 2 9 2 2 6 1 2 8 5 3 4 1 9 12 6 1 9 10 4 10 14 6 3 2 11 9 3 4 10 12 12 11 14 15 1 1 10 4 4 3 12 1 12 9 3 4 13 7 5 11 5 9 2 13 14 8 2 4 6 9 7 11 9 2 12 1...

output:

9

result:

ok single line: '9'

Test #60:

score: 18
Accepted
time: 5ms
memory: 9036kb

input:

500
9 5 6 3 6 1 8 3 8 1 4 3 9 2 10 3 10 1 9 4 9 2 7 7 12 6 1 2 2 3 14 5 1 1 8 3 11 9 6 2 15 4 15 1 7 8 15 2 9 6 2 1 8 9 7 3 10 7 2 10 12 8 8 8 11 2 11 4 3 4 6 1 4 3 9 14 2 2 13 6 5 2 14 7 5 1 3 7 12 1 1 5 13 4 14 10 15 13 6 12 1 2 2 7 2 9 12 3 3 4 8 10 1 6 1 7 2 10 3 6 4 4 11 10 13 7 7 11 2 15 8 3 1...

output:

8

result:

ok single line: '8'

Test #61:

score: 18
Accepted
time: 4ms
memory: 8436kb

input:

500
10 15 4 2 4 11 1 12 6 5 1 13 13 1 9 1 10 1 4 9 7 15 7 13 7 3 14 1 13 14 1 15 9 13 10 8 15 4 8 12 7 9 7 14 10 15 11 5 14 12 14 1 13 10 3 14 15 5 4 6 6 11 9 7 10 6 8 7 4 4 2 10 6 1 15 7 2 15 7 14 11 3 9 7 5 9 4 6 11 7 1 15 10 10 6 5 8 3 8 12 5 9 1 9 2 9 2 1 5 9 6 9 7 1 5 13 3 2 9 3 6 6 5 5 1 6 14 ...

output:

10

result:

ok single line: '10'

Test #62:

score: 18
Accepted
time: 4ms
memory: 6992kb

input:

500
15 15 14 15 15 15 14 13 15 15 13 13 13 15 15 15 15 15 15 14 15 15 15 15 15 14 15 15 15 15 15 13 15 13 15 14 15 15 13 13 12 13 15 12 15 14 13 13 15 15 14 12 15 13 12 15 14 15 12 14 14 15 12 15 13 12 13 12 12 12 13 12 14 15 15 14 13 13 13 12 11 13 13 12 15 15 11 14 12 13 11 15 13 12 13 13 11 11 15...

output:

14

result:

ok single line: '14'

Test #63:

score: 18
Accepted
time: 2ms
memory: 9160kb

input:

500
15 1 9 8 1 6 7 9 9 9 9 9 9 9 13 13 9 9 10 9 9 9 9 9 9 11 9 9 12 6 15 9 12 4 6 9 9 2 9 12 8 9 9 9 1 9 12 9 15 13 5 1 9 15 9 8 9 1 14 11 14 9 14 9 9 9 11 7 9 9 2 10 9 5 11 8 9 9 4 9 9 9 9 9 8 9 1 9 2 8 9 14 2 8 9 9 4 9 1 4 1 9 9 8 3 5 9 11 9 9 9 9 9 9 8 1 9 9 9 1 9 9 11 12 15 9 9 9 10 3 9 9 9 9 9 ...

output:

8

result:

ok single line: '8'

Test #64:

score: 18
Accepted
time: 4ms
memory: 6996kb

input:

500
8 3 15 8 8 15 8 8 8 8 8 3 3 8 8 8 4 8 8 8 4 8 8 8 15 8 8 8 8 8 8 8 8 8 8 1 8 8 8 8 8 8 8 8 8 8 8 6 8 8 8 8 8 8 8 8 8 8 8 8 8 15 8 3 8 8 8 8 8 8 8 10 8 14 8 8 8 6 2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 10 11 8 8 8 4 8 2 8 8 8 8 8 8 8 8 8 8 8 14 8 8 8 8 3 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 8 15 8 ...

output:

4

result:

ok single line: '4'

Test #65:

score: 18
Accepted
time: 5ms
memory: 8524kb

input:

500
6 3 5 6 3 6 6 6 3 6 6 3 3 6 6 3 4 6 6 3 3 3 3 6 14 6 3 3 6 6 6 3 6 3 6 6 3 6 3 6 3 6 3 11 6 3 3 6 5 10 15 3 6 3 6 6 6 6 6 3 3 3 3 3 3 6 6 6 6 3 3 12 6 3 3 6 6 6 6 3 6 3 6 3 3 6 6 3 5 3 3 3 3 6 4 6 6 6 6 6 3 6 6 6 3 3 3 3 3 3 3 3 6 3 2 6 3 3 6 3 3 6 3 3 6 3 3 6 6 6 6 3 3 15 9 3 6 3 6 6 3 6 3 3 3 ...

output:

4

result:

ok single line: '4'

Test #66:

score: 18
Accepted
time: 2ms
memory: 8296kb

input:

15
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

7

result:

ok single line: '7'

Test #67:

score: 18
Accepted
time: 4ms
memory: 8544kb

input:

30
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15

output:

1

result:

ok single line: '1'

Test #68:

score: 18
Accepted
time: 4ms
memory: 6992kb

input:

30
15 15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1

output:

15

result:

ok single line: '15'

Test #69:

score: 18
Accepted
time: 2ms
memory: 6944kb

input:

495
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

output:

1

result:

ok single line: '1'

Test #70:

score: 18
Accepted
time: 5ms
memory: 9032kb

input:

495
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13...

output:

15

result:

ok single line: '15'

Test #71:

score: 18
Accepted
time: 4ms
memory: 8548kb

input:

2
15 15

output:

1

result:

ok single line: '1'

Test #72:

score: 18
Accepted
time: 5ms
memory: 8848kb

input:

500
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

1

result:

ok single line: '1'

Subtask #5:

score: 26
Accepted

Test #73:

score: 26
Accepted
time: 16ms
memory: 85736kb

input:

500000
13 6 2 6 3 6 13 5 9 8 4 12 10 7 1 7 10 14 15 15 1 9 4 4 1 14 3 8 13 2 8 11 14 14 4 13 8 9 13 14 9 7 3 15 7 7 1 11 11 11 2 13 11 15 3 4 8 12 9 4 10 4 10 13 4 9 14 11 7 13 10 4 9 14 12 14 11 5 7 6 14 1 6 14 10 9 2 14 8 8 8 9 7 1 15 3 11 3 3 5 13 1 15 7 4 7 15 3 15 14 14 2 4 12 5 13 12 11 3 1 12...

output:

15

result:

ok single line: '15'

Test #74:

score: 26
Accepted
time: 13ms
memory: 87748kb

input:

500000
8 7 9 12 2 7 1 11 10 12 14 3 1 4 10 12 8 12 7 14 2 3 4 8 3 8 14 13 4 10 6 10 6 10 6 12 7 2 3 4 9 13 13 2 2 8 9 6 2 1 9 3 9 6 3 8 12 3 4 7 2 6 12 12 4 9 3 15 1 7 2 1 9 14 2 8 12 6 14 6 6 10 2 15 2 14 11 1 1 2 13 9 1 14 2 5 2 13 1 9 15 7 3 12 10 10 5 13 8 9 6 6 8 9 4 8 1 2 10 13 4 7 15 9 4 14 7...

output:

15

result:

ok single line: '15'

Test #75:

score: 26
Accepted
time: 14ms
memory: 84636kb

input:

500000
1 6 1 1 1 1 1 1 1 4 1 9 1 1 1 1 1 1 1 1 1 1 10 1 1 11 1 1 1 10 1 13 1 1 1 1 6 1 1 1 1 9 1 1 1 1 14 1 1 1 4 1 1 11 1 1 7 1 12 1 1 1 8 1 1 1 3 1 1 1 1 15 1 1 1 1 11 1 8 1 1 1 1 1 8 1 1 1 1 8 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 11 1 13 1 1 1 13 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 5 1 1 10 1 1 1 1 1 ...

output:

1

result:

ok single line: '1'

Test #76:

score: 26
Accepted
time: 19ms
memory: 86352kb

input:

499999
3 1 10 1 14 1 13 1 11 1 11 1 2 1 2 1 5 1 4 1 10 1 5 1 3 1 1 1 5 1 5 1 9 1 11 1 9 1 10 1 9 1 2 1 5 1 2 1 14 1 4 1 4 1 4 1 10 1 1 1 3 1 15 1 2 1 4 1 1 1 2 1 4 1 14 1 6 1 5 1 8 1 7 1 13 1 9 1 1 1 13 1 15 1 5 1 5 1 4 1 12 1 2 1 4 1 5 1 8 1 12 1 9 1 10 1 9 1 12 1 12 1 2 1 10 1 3 1 2 1 7 1 2 1 14 1...

output:

1

result:

ok single line: '1'

Test #77:

score: 26
Accepted
time: 13ms
memory: 87568kb

input:

500000
1 1 1 9 1 1 3 1 1 2 1 1 1 1 1 1 1 13 1 12 1 4 1 3 1 12 1 8 1 1 12 1 1 1 6 1 6 1 15 1 11 1 1 1 13 1 1 8 1 1 1 1 5 1 6 1 1 14 1 13 1 5 1 6 1 1 1 1 1 8 1 12 1 8 1 13 1 8 1 1 1 7 1 12 1 1 1 5 1 12 1 3 1 2 1 5 1 8 1 1 1 12 1 13 1 13 1 1 12 1 8 1 9 1 1 14 1 10 1 12 1 14 1 1 1 8 1 3 1 1 1 1 1 10 1 1...

output:

2

result:

ok single line: '2'

Test #78:

score: 26
Accepted
time: 16ms
memory: 86376kb

input:

500000
1 1 1 1 1 1 9 1 1 6 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 10 1 1 1 12 1 1 1 1 6 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 11 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 2 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 ...

output:

10

result:

ok single line: '10'

Test #79:

score: 26
Accepted
time: 17ms
memory: 88284kb

input:

500000
9 2 2 1 9 1 12 1 5 1 15 2 4 1 1 1 14 1 11 1 11 1 11 1 9 1 6 1 13 1 4 1 9 1 5 1 9 1 14 1 1 2 10 1 8 1 2 1 9 1 5 1 6 1 3 1 15 1 2 1 8 2 4 1 3 1 2 1 2 1 5 2 14 1 1 1 7 1 4 1 6 1 5 1 8 1 14 1 12 1 9 1 8 1 11 1 8 2 8 1 8 1 3 1 14 1 9 1 12 1 12 1 12 1 11 1 13 1 3 1 6 1 4 1 3 1 5 1 10 1 8 1 8 2 7 2 ...

output:

13

result:

ok single line: '13'

Test #80:

score: 26
Accepted
time: 16ms
memory: 86952kb

input:

500000
4 1 8 1 2 1 11 1 9 1 3 1 14 2 1 1 9 1 11 1 4 1 13 1 8 1 15 1 8 1 13 1 15 1 12 1 9 1 12 1 13 1 1 1 11 1 8 1 14 1 8 1 14 1 5 1 6 1 4 1 5 1 7 1 3 1 9 1 5 1 15 1 1 1 12 1 2 1 9 1 3 1 11 1 4 1 5 1 14 1 14 1 9 1 2 1 8 1 9 1 7 1 8 1 2 1 14 1 8 1 11 1 6 1 15 1 4 1 2 1 12 1 9 1 15 1 5 1 6 1 1 1 2 1 14...

output:

10

result:

ok single line: '10'

Test #81:

score: 26
Accepted
time: 14ms
memory: 86216kb

input:

500000
14 2 8 1 1 1 8 1 3 1 11 1 15 1 11 2 7 2 11 1 15 1 11 1 1 2 11 1 10 1 10 1 5 1 12 1 2 1 2 3 2 1 6 1 9 1 7 1 8 1 8 1 4 2 8 3 14 1 6 1 6 1 9 1 7 1 5 2 2 1 13 1 6 1 5 4 12 3 5 1 3 1 5 1 6 1 8 1 13 1 11 1 13 1 3 1 4 2 1 1 12 2 12 2 7 1 2 1 4 1 12 1 11 2 6 3 6 1 11 1 10 1 6 1 4 1 3 1 3 1 11 1 3 1 4...

output:

15

result:

ok single line: '15'

Test #82:

score: 26
Accepted
time: 16ms
memory: 85536kb

input:

500000
15 15 15 14 13 15 15 15 15 15 13 15 15 15 15 15 14 15 14 15 15 13 15 15 14 15 13 15 15 15 14 15 13 13 15 14 15 15 15 15 14 15 15 14 13 15 15 15 15 15 15 13 15 14 14 15 13 15 15 15 15 15 15 13 14 15 15 15 15 13 14 13 15 14 14 15 15 15 15 13 14 15 15 14 15 15 15 13 15 15 15 13 13 14 15 15 14 15...

output:

15

result:

ok single line: '15'

Test #83:

score: 26
Accepted
time: 14ms
memory: 87768kb

input:

500000
8 7 11 7 7 6 7 13 7 11 2 7 7 7 11 15 13 11 9 3 4 5 7 7 9 11 7 7 5 4 8 7 7 7 7 2 12 13 5 1 4 4 7 7 4 14 5 7 7 7 6 4 1 8 10 13 7 7 7 7 15 7 9 6 4 9 15 7 5 7 3 7 7 4 7 7 11 6 8 6 7 7 7 7 3 7 1 10 2 7 6 7 11 7 7 8 4 5 15 11 7 15 7 7 11 2 9 7 14 7 6 7 7 1 4 7 14 6 7 7 1 2 1 7 7 13 7 1 7 6 15 7 9 6...

output:

15

result:

ok single line: '15'

Test #84:

score: 26
Accepted
time: 13ms
memory: 86336kb

input:

500000
2 2 2 2 4 2 2 2 1 1 2 2 2 2 2 2 6 2 10 11 2 10 2 2 2 2 2 11 2 2 11 15 2 2 2 5 2 7 2 2 2 2 10 2 12 2 2 2 2 2 2 2 2 2 2 2 2 2 2 11 2 2 2 2 9 2 2 2 15 2 1 2 2 2 2 2 2 2 2 5 3 8 2 2 2 2 2 2 2 2 11 2 2 2 2 2 2 2 13 2 2 2 2 2 2 2 2 9 2 2 12 2 15 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

15

result:

ok single line: '15'

Test #85:

score: 26
Accepted
time: 17ms
memory: 86876kb

input:

500000
13 1 13 1 1 13 13 13 1 1 13 13 13 1 13 1 1 1 1 1 13 13 4 13 1 13 1 13 13 1 13 1 13 3 13 1 10 13 13 13 13 1 1 1 13 13 1 11 1 1 13 13 1 1 1 13 5 13 1 13 1 13 13 13 1 13 1 13 1 1 1 1 7 13 1 1 8 1 1 13 13 13 9 13 13 13 13 1 1 1 1 1 1 13 1 1 1 13 13 1 15 13 1 13 3 13 13 13 13 6 2 13 13 13 13 1 13 ...

output:

15

result:

ok single line: '15'

Test #86:

score: 26
Accepted
time: 15ms
memory: 88208kb

input:

499995
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #87:

score: 26
Accepted
time: 15ms
memory: 86220kb

input:

499995
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

15

result:

ok single line: '15'

Test #88:

score: 26
Accepted
time: 15ms
memory: 86628kb

input:

500000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

1

result:

ok single line: '1'

Test #89:

score: 26
Accepted
time: 17ms
memory: 86124kb

input:

500000
4 1 9 1 9 1 10 1 10 1 4 1 15 1 4 1 6 1 14 1 2 1 1 1 13 1 10 1 1 1 4 1 12 1 2 1 14 1 10 1 8 1 13 1 10 1 15 1 14 1 2 1 8 1 5 1 3 1 4 1 9 1 6 1 15 1 9 1 3 1 15 1 3 1 13 1 9 1 13 1 14 1 14 1 8 1 12 1 11 1 10 1 3 1 4 1 1 2 12 1 11 1 3 1 11 1 6 1 4 1 7 1 13 1 13 1 8 1 14 1 12 1 6 1 4 1 15 1 2 1 7 1...

output:

12

result:

ok single line: '12'

Test #90:

score: 26
Accepted
time: 15ms
memory: 86712kb

input:

500000
14 1 6 2 6 1 8 1 11 1 14 1 1 1 8 1 15 1 12 1 14 1 13 2 12 1 1 1 6 1 9 1 15 1 4 1 2 1 12 2 7 1 2 1 8 2 4 1 13 2 14 2 14 1 10 1 14 1 3 1 2 1 14 1 6 1 1 2 13 1 8 1 10 1 2 1 11 1 14 1 6 1 4 2 7 1 10 1 15 1 7 1 8 1 1 1 4 1 12 1 13 1 13 1 1 1 8 1 12 1 7 2 10 1 3 1 3 1 12 1 8 2 11 1 4 1 1 1 14 1 15 ...

output:

13

result:

ok single line: '13'

Test #91:

score: 26
Accepted
time: 14ms
memory: 85248kb

input:

500000
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

14

result:

ok single line: '14'

Test #92:

score: 26
Accepted
time: 13ms
memory: 88092kb

input:

500000
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

12

result:

ok single line: '12'

Subtask #6:

score: 10
Accepted

Test #93:

score: 10
Accepted
time: 356ms
memory: 158780kb

input:

500000
18 13 10 17 5 21 13 19 14 14 11 5 11 21 9 15 1 12 4 17 10 18 14 10 1 14 8 15 6 10 7 13 17 12 7 2 11 20 12 8 13 21 3 1 1 5 15 8 9 14 15 15 12 12 15 7 21 12 1 8 7 20 2 1 12 18 4 4 17 1 1 6 12 6 21 12 7 11 17 5 5 19 7 21 21 16 13 17 5 16 19 14 3 3 5 4 15 2 21 12 20 21 1 2 16 15 5 17 12 4 11 19 1...

output:

21

result:

ok single line: '21'

Test #94:

score: 10
Accepted
time: 372ms
memory: 159708kb

input:

500000
3 14 11 18 13 6 14 19 1 3 13 2 11 10 21 7 17 20 5 7 7 9 10 8 7 5 2 10 19 12 5 16 21 15 15 1 9 21 5 18 2 20 9 2 5 21 12 15 9 9 17 9 13 8 18 11 16 16 19 5 18 9 3 1 1 3 15 3 6 17 3 2 20 3 1 10 15 20 16 4 2 1 4 19 8 6 7 10 3 10 11 21 10 8 21 14 6 4 4 11 9 21 4 10 21 13 16 6 10 2 15 17 11 21 10 6 ...

output:

21

result:

ok single line: '21'

Test #95:

score: 10
Accepted
time: 337ms
memory: 158932kb

input:

500000
1 1 1 14 1 1 14 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 12 1 1 1 1 1 1 1 1 1 5 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 17 1 3 1 1 1 1 13 1 1 1 1 1 17 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 19 1 5 1 1 11 1 1 1 1 1 15 1 16 1 1 1 8 1 1 17 1 1 1 20 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #96:

score: 10
Accepted
time: 338ms
memory: 157256kb

input:

499999
7 1 12 1 5 1 16 1 16 1 7 1 1 1 13 1 12 1 12 1 9 1 6 1 7 1 12 1 8 1 4 1 18 1 21 1 5 1 21 1 10 1 19 1 16 1 6 1 9 1 17 1 17 1 5 1 5 1 17 1 19 1 1 1 2 1 4 1 20 1 14 1 4 1 12 1 9 1 11 1 9 1 2 1 1 1 17 1 16 1 14 1 15 1 8 1 4 1 15 1 21 1 11 1 16 1 13 1 14 1 8 1 8 1 2 1 9 1 9 1 19 1 17 1 17 1 21 1 8 ...

output:

1

result:

ok single line: '1'

Test #97:

score: 10
Accepted
time: 344ms
memory: 160432kb

input:

500000
18 1 1 1 14 1 1 5 1 15 1 5 1 8 1 12 1 13 1 17 1 1 1 7 1 17 1 15 1 3 1 1 12 1 11 1 7 1 18 1 8 1 14 1 1 16 1 18 1 20 1 8 1 1 12 1 1 11 1 16 1 21 1 5 1 1 1 1 1 4 1 14 1 8 1 8 1 1 5 1 6 1 2 1 7 1 2 1 1 1 1 1 21 1 20 1 19 1 6 1 6 1 1 3 1 13 1 1 1 21 1 2 1 17 1 1 3 1 6 1 2 1 13 1 1 6 1 20 1 16 1 9 ...

output:

2

result:

ok single line: '2'

Test #98:

score: 10
Accepted
time: 417ms
memory: 158760kb

input:

500000
1 1 1 1 1 1 1 8 2 2 1 1 2 1 1 1 1 1 1 1 1 2 1 14 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 2 1 9 1 1 1 1 10 1 1 15 1 1 1 1 15 1 1 14 1 21 1 1 3 1 15 1 1 11 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 15 1 1 2 21 1 1 1 1 1 1 5 1 1 6 1 1 1 1 1 4 1 2 3 1 2 1 1 1 1 1 3 1 15 1 1 1 2 1 1 3 1 1 1 1 1 1 1 1 1...

output:

15

result:

ok single line: '15'

Test #99:

score: 10
Accepted
time: 397ms
memory: 157136kb

input:

500000
13 2 6 1 6 1 4 1 10 1 2 1 20 1 13 3 7 1 5 1 4 1 7 1 2 1 19 1 8 1 17 1 15 1 2 2 3 1 18 1 2 1 12 4 10 2 21 1 10 1 2 1 20 1 17 1 3 1 19 1 9 1 11 1 13 1 12 2 15 2 7 1 10 1 21 1 15 1 16 2 13 1 1 2 15 1 1 1 21 2 5 1 19 1 17 2 15 1 18 1 21 5 1 1 8 3 10 1 18 1 15 1 4 1 8 1 11 2 21 1 19 3 4 1 19 1 15 ...

output:

19

result:

ok single line: '19'

Test #100:

score: 10
Accepted
time: 406ms
memory: 159916kb

input:

500000
15 1 14 1 12 1 18 1 2 1 21 1 10 1 2 1 12 1 19 1 21 1 19 1 16 1 16 1 3 1 4 1 20 1 4 1 8 1 7 2 10 1 5 1 11 1 21 1 9 1 17 1 16 1 11 1 9 1 21 1 1 1 15 1 19 2 11 1 9 1 2 2 3 1 12 1 4 1 1 1 2 1 9 1 15 1 17 2 19 1 21 1 12 1 5 1 19 1 15 1 5 1 1 1 14 1 12 1 12 1 12 1 4 1 1 1 14 1 20 2 6 1 15 1 17 1 2 ...

output:

16

result:

ok single line: '16'

Test #101:

score: 10
Accepted
time: 399ms
memory: 158028kb

input:

500000
21 3 19 1 17 1 10 2 17 1 14 2 12 4 2 2 11 1 11 2 16 1 17 2 19 1 15 2 3 1 21 5 12 1 3 2 16 3 12 1 11 8 13 1 16 1 20 2 12 1 19 1 14 1 7 1 2 2 21 1 4 4 17 2 2 2 12 1 9 2 12 2 19 1 9 1 7 4 20 1 13 2 17 2 7 1 4 2 14 2 10 1 20 3 18 1 15 1 15 3 17 1 3 2 17 1 6 1 13 2 17 10 21 3 9 3 13 2 7 4 19 1 4 1...

output:

21

result:

ok single line: '21'

Test #102:

score: 10
Accepted
time: 408ms
memory: 159200kb

input:

500000
19 1 1 1 7 1 19 1 9 1 10 1 15 1 20 1 16 5 6 2 8 1 9 1 17 1 16 2 7 1 15 1 4 4 10 1 6 1 9 1 3 1 4 1 17 1 7 1 21 1 1 1 4 1 5 2 21 3 17 1 1 1 3 1 6 1 18 1 11 1 17 3 17 2 19 1 3 1 7 3 12 1 17 2 10 1 8 1 11 1 17 1 18 1 3 1 17 2 11 1 13 2 8 2 14 2 12 4 16 1 7 3 9 1 4 1 4 1 15 1 18 1 10 1 6 1 14 3 13...

output:

18

result:

ok single line: '18'

Test #103:

score: 10
Accepted
time: 398ms
memory: 157724kb

input:

500000
10 1 20 2 11 1 19 1 3 1 21 2 6 1 10 1 2 1 12 1 9 1 21 1 7 3 16 1 3 1 20 1 10 2 14 2 20 2 3 2 6 2 5 1 6 1 17 1 3 3 3 2 19 2 6 1 4 1 8 1 3 1 12 3 6 1 11 1 14 1 2 1 14 1 8 2 11 1 11 2 13 1 10 1 9 1 16 1 15 2 19 2 1 2 8 2 17 1 19 2 13 2 7 1 6 1 18 2 16 1 9 2 17 1 11 2 14 2 13 4 21 2 4 1 12 4 3 1 ...

output:

19

result:

ok single line: '19'

Test #104:

score: 10
Accepted
time: 400ms
memory: 159064kb

input:

500000
2 2 19 1 6 1 16 1 17 1 1 1 8 3 11 1 6 1 8 1 19 1 1 1 7 1 2 1 18 2 14 1 11 1 9 1 1 3 7 1 16 1 2 1 14 1 18 1 15 1 6 1 16 1 13 2 12 1 16 2 2 1 1 2 7 1 21 1 16 1 5 1 8 1 7 2 1 2 8 1 12 3 4 1 7 1 8 1 20 1 18 1 12 1 11 1 18 1 2 1 7 2 17 1 13 1 5 1 2 3 12 1 3 1 3 1 6 1 9 1 7 1 2 1 19 1 18 1 10 1 17 ...

output:

18

result:

ok single line: '18'

Test #105:

score: 10
Accepted
time: 363ms
memory: 159448kb

input:

500000
21 21 20 21 20 21 21 18 21 19 20 21 21 19 21 21 20 21 21 21 21 19 19 21 21 21 21 21 20 20 20 21 21 20 21 18 21 20 18 19 19 21 21 20 21 19 21 21 21 21 20 21 19 21 21 18 18 18 21 18 19 21 21 21 21 18 21 21 19 21 18 19 21 19 19 19 21 20 21 19 18 20 21 19 21 21 18 21 21 18 18 21 21 21 21 21 21 21...

output:

21

result:

ok single line: '21'

Test #106:

score: 10
Accepted
time: 366ms
memory: 160184kb

input:

500000
6 14 14 14 17 2 14 14 14 14 12 11 20 17 14 14 14 2 14 8 7 6 2 14 13 14 14 14 14 14 14 14 1 14 14 14 1 14 14 14 14 1 14 4 14 15 14 14 13 12 2 4 3 1 14 14 17 13 1 14 8 14 14 14 16 14 14 21 14 16 1 14 17 16 19 14 14 19 14 14 14 14 11 20 14 14 18 17 14 14 14 13 12 14 14 5 14 21 4 14 14 2 14 17 14...

output:

21

result:

ok single line: '21'

Test #107:

score: 10
Accepted
time: 371ms
memory: 159424kb

input:

500000
9 9 9 9 9 10 9 9 21 9 9 6 9 9 9 9 9 6 9 9 9 9 9 9 9 9 9 9 12 9 9 9 9 6 9 9 8 20 6 9 9 21 9 9 9 9 20 9 9 9 9 9 9 9 3 9 9 9 9 9 9 9 9 19 9 9 9 9 11 9 9 9 9 5 15 11 9 9 9 9 9 9 9 9 9 20 9 20 9 9 9 5 9 9 9 9 9 9 9 4 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 2 9 16 10 9 11 16 9 9 9 9 16 9 9 19 9 4 9 2 9 9 9 ...

output:

21

result:

ok single line: '21'

Test #108:

score: 10
Accepted
time: 379ms
memory: 158192kb

input:

500000
20 16 16 16 16 16 16 19 5 16 5 16 16 5 5 5 16 16 16 5 16 16 5 6 5 5 16 16 18 16 5 16 16 16 16 16 5 5 16 5 5 16 5 5 16 5 5 16 16 5 16 7 16 5 16 5 16 5 5 20 12 9 16 16 5 16 17 16 7 16 5 5 16 5 16 5 16 5 16 16 5 16 16 5 5 5 16 5 16 16 16 5 5 16 5 5 16 5 16 16 16 5 5 16 5 5 5 16 16 5 16 5 5 5 6 1...

output:

19

result:

ok single line: '19'

Test #109:

score: 10
Accepted
time: 280ms
memory: 79312kb

input:

21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

output:

1

result:

ok single line: '1'

Test #110:

score: 10
Accepted
time: 274ms
memory: 79512kb

input:

21
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

output:

10

result:

ok single line: '10'

Test #111:

score: 10
Accepted
time: 295ms
memory: 79480kb

input:

42
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21

output:

1

result:

ok single line: '1'

Test #112:

score: 10
Accepted
time: 290ms
memory: 79356kb

input:

42
21 21 20 20 19 19 18 18 17 17 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1

output:

21

result:

ok single line: '21'

Test #113:

score: 10
Accepted
time: 380ms
memory: 158608kb

input:

499989
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok single line: '1'

Test #114:

score: 10
Accepted
time: 367ms
memory: 158748kb

input:

499989
21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21...

output:

21

result:

ok single line: '21'

Test #115:

score: 10
Accepted
time: 330ms
memory: 157516kb

input:

500000
21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21...

output:

1

result:

ok single line: '1'

Test #116:

score: 10
Accepted
time: 359ms
memory: 158412kb

input:

500000
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...

output:

21

result:

ok single line: '21'

Test #117:

score: 10
Accepted
time: 350ms
memory: 159360kb

input:

500000
21 20 19 18 17 16 15 14 12 11 10 9 8 7 6 5 4 3 2 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

output:

19

result:

ok single line: '19'

Test #118:

score: 10
Accepted
time: 353ms
memory: 158940kb

input:

500000
21 20 19 18 17 16 15 14 13 11 10 9 8 7 6 5 4 3 1 18 15 18 15 15 18 18 18 15 18 15 15 18 15 18 15 15 15 18 18 15 18 18 18 18 15 15 15 18 18 15 15 15 18 18 15 15 15 15 18 15 18 15 18 15 18 15 18 15 15 18 18 18 15 18 15 18 18 15 15 18 18 15 18 15 15 15 15 18 18 18 18 18 15 18 15 18 18 15 15 15 1...

output:

17

result:

ok single line: '17'

Test #119:

score: 10
Accepted
time: 345ms
memory: 159264kb

input:

500000
21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...

output:

20

result:

ok single line: '20'

Test #120:

score: 10
Accepted
time: 358ms
memory: 157512kb

input:

500000
21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...

output:

19

result:

ok single line: '19'

Test #121:

score: 10
Accepted
time: 360ms
memory: 159764kb

input:

500000
21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...

output:

17

result:

ok single line: '17'

Subtask #7:

score: 18
Accepted

Test #122:

score: 18
Accepted
time: 502ms
memory: 1044548kb

input:

5000000
13 18 3 21 9 14 1 14 7 16 2 17 21 12 14 1 1 15 15 18 18 16 19 18 2 3 13 5 14 14 13 3 2 9 3 20 7 17 16 14 13 8 21 12 6 3 6 13 2 19 3 5 14 21 3 11 21 10 12 14 3 13 21 13 1 8 8 16 9 10 17 5 17 3 11 10 2 9 15 11 15 13 10 12 6 8 16 21 11 9 15 17 18 1 20 14 16 3 18 5 5 6 12 16 6 7 5 16 11 11 18 16...

output:

21

result:

ok single line: '21'

Test #123:

score: 18
Accepted
time: 536ms
memory: 1044688kb

input:

5000000
5 21 15 12 8 17 15 17 10 15 1 1 2 9 17 3 14 6 7 5 16 19 12 7 7 14 18 15 14 9 13 3 20 4 2 8 14 8 10 5 4 20 10 7 17 12 2 21 2 19 7 10 17 7 13 12 18 19 17 7 2 6 1 19 12 6 13 16 1 12 19 14 5 3 20 1 7 4 16 6 10 14 5 6 15 6 9 6 9 21 21 21 19 8 1 13 9 19 4 20 5 10 21 16 12 21 9 8 13 2 16 16 19 8 20...

output:

21

result:

ok single line: '21'

Test #124:

score: 18
Accepted
time: 443ms
memory: 1044668kb

input:

5000000
1 1 1 1 1 1 9 1 1 7 1 8 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 11 1 1 1 1 1 1 1 17 1 14 1 1 1 4 1 1 1 11 1 1 20 1 14 1 1 1 1 1 1 1 6 1 1 1 1 1 21 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 8 1 1 1 1 1 1 19 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 15 1 1 11 1 1 1 7 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1

result:

ok single line: '1'

Test #125:

score: 18
Accepted
time: 443ms
memory: 1044520kb

input:

4999999
7 1 12 1 20 1 9 1 10 1 3 1 7 1 21 1 14 1 21 1 20 1 4 1 12 1 21 1 21 1 3 1 11 1 20 1 10 1 7 1 11 1 20 1 4 1 18 1 7 1 13 1 15 1 14 1 6 1 8 1 3 1 10 1 7 1 16 1 16 1 11 1 8 1 9 1 15 1 12 1 6 1 14 1 3 1 12 1 16 1 14 1 7 1 9 1 9 1 1 1 19 1 11 1 17 1 16 1 18 1 17 1 9 1 2 1 15 1 14 1 18 1 10 1 14 1 ...

output:

1

result:

ok single line: '1'

Test #126:

score: 18
Accepted
time: 469ms
memory: 1044532kb

input:

5000000
18 1 8 1 1 1 20 1 10 1 1 1 1 21 1 17 1 1 15 1 14 1 1 1 1 9 1 2 1 8 1 10 1 4 1 14 1 1 1 14 1 9 1 11 1 4 1 5 1 1 1 1 11 1 13 1 1 14 1 1 1 2 1 7 1 1 1 1 1 1 1 2 1 1 4 1 15 1 1 1 19 1 12 1 19 1 1 2 1 18 1 11 1 1 14 1 15 1 4 1 9 1 13 1 8 1 21 1 2 1 14 1 1 4 1 10 1 1 1 1 5 1 14 1 20 1 3 1 5 1 21 1...

output:

2

result:

ok single line: '2'

Test #127:

score: 18
Accepted
time: 521ms
memory: 1044880kb

input:

5000000
1 1 1 1 1 1 11 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 1 1 1 1 13 2 1 1 1 1 1 1 14 1 1 1 7 1 3 2 1 1 2 1 1 7 1 1 2 1 1 1 1 1 2 1 2 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 16 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 ...

output:

17

result:

ok single line: '17'

Test #128:

score: 18
Accepted
time: 509ms
memory: 1044948kb

input:

5000000
6 1 18 1 1 1 19 1 14 2 3 1 13 2 21 2 2 1 21 1 17 1 5 2 12 1 8 2 3 2 7 1 11 1 21 1 10 1 4 2 2 2 7 2 16 1 11 1 3 1 5 1 20 1 6 1 20 1 8 1 21 1 15 1 19 1 19 1 14 1 10 1 5 1 8 1 14 1 1 4 14 1 13 1 17 1 3 1 7 1 9 2 7 1 8 2 20 1 6 2 18 1 3 2 12 1 3 2 1 1 21 2 21 1 9 1 16 1 12 1 4 2 5 2 20 1 12 1 14...

output:

20

result:

ok single line: '20'

Test #129:

score: 18
Accepted
time: 513ms
memory: 1045656kb

input:

5000000
2 1 1 1 13 2 11 1 13 1 2 1 14 1 9 1 17 1 13 1 18 1 10 1 12 1 15 1 16 1 1 1 4 1 19 2 17 1 6 1 21 1 7 2 20 1 17 1 5 1 8 1 11 2 6 1 20 1 19 1 3 1 1 1 2 1 3 1 2 1 5 1 15 1 19 1 11 1 20 1 9 1 8 1 6 1 6 1 3 1 4 1 1 2 8 2 2 1 11 1 4 1 9 1 13 1 1 1 18 1 20 1 20 1 21 1 9 1 4 1 5 1 8 1 6 1 12 1 17 2 3...

output:

17

result:

ok single line: '17'

Test #130:

score: 18
Accepted
time: 503ms
memory: 1044628kb

input:

5000000
19 1 10 1 12 1 6 2 18 1 19 2 4 1 21 1 8 2 9 2 8 1 12 4 18 2 21 4 21 2 2 2 14 3 18 1 17 1 9 3 15 1 19 1 8 3 16 2 15 3 19 3 6 3 16 1 4 2 15 1 13 1 10 1 10 1 6 3 3 1 15 2 9 2 13 1 18 3 12 2 7 4 3 2 12 1 16 1 5 1 12 7 16 3 14 2 21 1 2 1 21 1 5 2 19 2 20 1 18 2 5 1 16 2 19 1 5 1 15 1 16 6 1 1 2 1...

output:

21

result:

ok single line: '21'

Test #131:

score: 18
Accepted
time: 462ms
memory: 1044056kb

input:

5000000
19 21 21 18 20 21 19 21 18 21 20 21 21 21 21 20 21 21 18 19 18 18 21 20 21 21 21 20 21 21 20 19 21 21 18 18 18 21 18 20 18 21 21 20 21 20 21 20 19 19 21 21 21 18 20 21 21 18 21 21 21 21 18 21 19 19 21 18 21 19 21 20 21 21 19 20 20 20 21 21 21 21 21 21 18 21 21 18 18 21 21 19 20 20 19 20 20 2...

output:

21

result:

ok single line: '21'

Test #132:

score: 18
Accepted
time: 493ms
memory: 1044512kb

input:

5000000
4 4 4 4 4 17 12 17 4 4 6 4 10 4 7 4 4 4 4 6 17 19 12 4 4 4 4 4 4 18 11 20 20 12 4 12 16 1 4 19 15 13 3 4 7 4 4 4 6 1 14 19 4 12 13 11 12 4 4 4 4 4 18 1 4 4 4 19 15 12 15 13 4 4 6 4 18 4 20 4 4 4 21 1 4 4 4 4 17 9 4 4 16 4 4 4 9 14 11 4 4 20 17 11 4 4 4 10 7 4 10 10 4 4 12 15 6 4 10 14 4 4 17...

output:

21

result:

ok single line: '21'

Test #133:

score: 18
Accepted
time: 473ms
memory: 1045724kb

input:

5000000
14 14 5 17 14 14 14 10 14 14 14 14 14 14 14 14 14 14 14 14 12 14 14 14 14 14 14 14 14 14 13 14 14 12 19 4 14 14 14 14 14 14 14 5 14 14 14 14 19 14 14 4 14 14 14 9 14 20 14 14 14 14 14 16 14 14 14 14 14 14 14 14 14 20 8 14 20 14 14 2 16 14 16 21 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14...

output:

21

result:

ok single line: '21'

Test #134:

score: 18
Accepted
time: 474ms
memory: 1042416kb

input:

5000000
14 3 9 3 3 3 9 9 9 3 9 3 3 3 9 3 3 9 3 7 3 3 3 9 3 12 15 3 9 8 19 9 9 3 3 9 3 3 3 3 9 9 9 21 3 9 3 3 3 9 3 3 3 3 9 9 9 9 9 9 3 9 3 3 10 9 9 9 3 3 1 3 9 9 9 3 9 9 5 14 3 3 3 9 3 3 3 17 3 9 9 9 3 3 9 3 9 9 3 3 3 15 3 9 3 9 9 3 9 9 9 9 3 9 3 9 9 9 9 3 9 3 18 9 3 3 9 3 3 3 9 17 9 9 3 9 9 3 9 3 9...

output:

21

result:

ok single line: '21'

Test #135:

score: 18
Accepted
time: 492ms
memory: 1045068kb

input:

4999995
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1

result:

ok single line: '1'

Test #136:

score: 18
Accepted
time: 482ms
memory: 1045572kb

input:

4999995
21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 2...

output:

21

result:

ok single line: '21'

Test #137:

score: 18
Accepted
time: 429ms
memory: 1046444kb

input:

5000000
21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 2...

output:

1

result:

ok single line: '1'

Test #138:

score: 18
Accepted
time: 507ms
memory: 1044164kb

input:

5000000
9 1 19 1 10 1 20 1 13 1 12 1 16 1 21 1 6 1 5 1 7 1 15 1 18 2 7 1 10 1 2 1 18 1 9 1 13 1 11 2 18 1 17 3 12 1 2 2 3 1 14 1 12 1 19 1 19 2 17 1 1 3 1 1 19 1 7 1 8 1 21 1 15 1 5 1 6 1 1 1 21 1 10 1 19 1 1 2 10 1 16 1 4 1 16 1 15 1 7 1 17 1 21 1 7 1 3 1 13 2 2 1 19 1 20 1 17 1 13 1 10 1 5 2 3 1 2...

output:

19

result:

ok single line: '19'

Test #139:

score: 18
Accepted
time: 512ms
memory: 1044856kb

input:

5000000
20 1 21 1 18 1 1 2 7 2 11 1 12 1 9 1 16 1 9 1 17 1 7 1 7 1 15 2 2 1 12 1 21 1 13 1 11 1 18 1 7 3 8 1 3 1 19 1 14 2 6 1 5 1 4 3 11 1 13 1 4 1 4 1 10 1 12 2 19 1 14 1 8 3 20 1 14 1 21 1 7 1 15 1 7 1 14 1 3 1 9 1 14 1 19 1 3 1 3 1 14 2 16 1 4 1 13 2 21 1 9 2 9 1 13 5 7 1 17 1 19 1 6 1 5 1 19 1 ...

output:

20

result:

ok single line: '20'

Test #140:

score: 18
Accepted
time: 462ms
memory: 1047092kb

input:

5000000
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...

output:

21

result:

ok single line: '21'

Test #141:

score: 18
Accepted
time: 467ms
memory: 1047836kb

input:

5000000
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ...

output:

19

result:

ok single line: '19'

Test #142:

score: 18
Accepted
time: 485ms
memory: 1043804kb

input:

5000000
21 19 18 17 16 14 13 12 11 10 9 8 7 6 5 4 3 2 1 5 20 20 5 20 5 5 5 5 20 5 5 5 20 20 20 20 20 5 5 20 20 20 20 5 20 5 20 20 5 5 20 5 5 5 20 20 5 5 5 20 5 5 5 5 5 5 5 20 5 5 20 20 20 5 20 20 20 20 20 20 20 20 20 20 20 20 5 5 20 5 20 20 5 5 5 20 5 5 5 5 5 5 20 20 20 5 5 5 20 5 5 20 5 5 20 5 5 20...

output:

17

result:

ok single line: '17'

Test #143:

score: 18
Accepted
time: 475ms
memory: 1047744kb

input:

5000000
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...

output:

18

result:

ok single line: '18'

Test #144:

score: 18
Accepted
time: 469ms
memory: 1046668kb

input:

5000000
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...

output:

16

result:

ok single line: '16'

Test #145:

score: 18
Accepted
time: 484ms
memory: 1044120kb

input:

5000000
21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 21 6 6 6 6 6 21 21 6 21 21 21 21 6 21 6 21 6 6 6 6 21 6 6 21 21 6 21 6 21 6 21 6 21 6 6 6 21 21 6 21 21 21 6 21 6 6 21 21 6 21 6 21 21 6 21 21 6 6 6 21 6 6 6 21 21 21 6 21 6 6 21 6 6 21 6 21 6 6 6 6 21 21 6 6 6 21 21 21 6 21 6 21 21 6 21 ...

output:

16

result:

ok single line: '16'

Extra Test:

score: 0
Extra Test Passed