using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mochila
{
    class Rick
    {
        public int Grito { get; set; }

        public Rick(int grito)
        {
            Grito = grito;
        }
    }

    class Program
    {
        static bool verificaGritos(int a, int b, int c, int d)
        {
            int SomaRick = a + b;
            int SomaMorty = c + d;
            int diferenca = 0;

            if (SomaRick > SomaMorty)
            {
                diferenca = SomaRick - SomaMorty;

                if (diferenca > c)
                    return false;
                else
                    return true;
            }
            else
            {
                diferenca = SomaMorty - SomaRick;

                if (diferenca > a)
                    return false;
                else
                    return true;
            }
        }

        static int comparaComRick(List<Rick> lista, int morty)
        {
            int igual = -1;

            for (int i = 0; i < lista.Count; i++)
            {
                if (lista[i].Grito == morty)
                {
                    igual = morty;
                }
            }

            return igual;
        }

        static void verificaGritosIguais(int a, int b, int c, int d)
        {
            List<Rick> lista = new List<Rick>();
            int cont = 1, rick = 0, morty = 0, igual = -1;   // Igual j� come�a com -1, caso n�o entre no if, j� sai -1 igual o problema pede

            if (verificaGritos(a, b, c, d))
            {
                do
                {
                    rick = b + (a * cont);        // sequ�ncia de gritos de Rick.
                    morty = c + (d * cont);       // sequ�ncia de gritos de Morty.

                    cont++;                       // contador da sequ�ncia.

                    lista.Add(new Rick(rick));    // Somente o grito do Rick � guardado

                    igual = comparaComRick(lista, morty);   // Vai comparar o grito do morty com os gritos guardados do Rick

                } while (igual != morty);         // Enquanto n�o gritarem ao mesmo tempo

                Console.WriteLine(igual);
            }
            else
            {
                Console.WriteLine(igual);
            }
        }

        static void Main(string[] args)
        {
            string R = Console.ReadLine();
            int a = (int)char.Parse((R.Split((char)32)))[0]);
            int b = (int)char.Parse((R.Split((char)32))[1]);

            string M = Console.ReadLine();
            int c = (int)char.Parse((R.Split((char)32))[0]);
            int d = (int)char.Parse((R.Split((char)32))[1]);

            verificaGritosIguais(a, b, c, d);
        }
    }
}


using System;
using System.Linq;
using System.Numerics;

namespace ConsoleApplication4
{
	class Program
	{
		private static BigInteger n;
		static BigInteger m;

		static bool check(BigInteger k)
		{
			BigInteger val = n + (k - m) - (m + k)*(k - m + 1)/2);
			return val <= 0;
		}

		static void Main(string[] args)
		{
			var arr =
				Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToArray();
			n = arr[0];
			m = arr[1];
			if (n < m)
			{
				Console.WriteLine(n);
			}

			BigInteger val = n + m*m - (1+ m)*m/2;
			BigInteger l = m, r = BigInteger.Parse("100000000000000000000000000000000000000000000000000000000");
			while (r - l > 1)
			{
				var c = (r + l)/2;
				if (check(c))
				{
					r = c;
				}
				else
				{
					l = c;
				}
			}

			if (check(l))
			{
				r = l;
			}

			Console.WriteLine(r);
		}
	}
}


using System;
using System.Reflection.Metadata;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            int space = input.IndexOf(' ');

            long barnCapacity = long.Parse(input.Substring(0, space)),
                 incomingGrains = long.Parse(input.Substring(space + 1)),
                 sparrows = 0,
                 progressionSum = 0;

            if (barnCapacity - incomingGrains <= 0)
            {
                Console.WriteLine(barnCapacity);
                return;
            }

            barnCapacity -= incomingGrains;

            if (barnCapacity <= 10) goto simpleLoop;

            int i = 1;
            while (progressionSum <= 0 && barnCapacity > progressionSum)
            {
                i *= 10;
                sparrows = barnCapacity / i;
                progressionSum = GetArithmeticProgressionSum(sparrows);
            }

            var addition = sparrows / 10;
            if (addition < 2)
            {
                sparrows = 0;
                goto simpleLoop;
            }

            complexLoop:
            if (barnCapacity > progressionSum)
            {
                if (addition > 2)
                    while (true)
                    {
                        if (GetArithmeticProgressionSum(sparrows + addition) > barnCapacity)
                        {
                            addition /= 2;
                            goto complexLoop;
                        }

                        sparrows += addition;
                    }
            }
            else
            {
                if (addition > 2)
                    while (true)
                    {
                        if (GetArithmeticProgressionSum(sparrows - addition) < barnCapacity)
                        {
                            addition /= 2;
                            goto complexLoop;
                        }

                        sparrows -= addition;
                    }
            }

            var correctionSum = GetArithmeticProgressionSum(sparrows);
            if (correctionSum > barnCapacity)
            {
                while (GetArithmeticProgressionSum(sparrows - 1) > barnCapacity) sparrows--;
                goto finish;
            }

            barnCapacity -= correctionSum;
            simpleLoop:
            do { barnCapacity -= ++sparrows; } while (barnCapacity > 0);

            finish:
            Console.WriteLine(sparrows + incomingGrains);
        }

        static long GetArithmeticProgressionSum(long value)
        {
            return (long)(((double)(1 + value) / 2) * value);
        }
    }
}


using System;
using System.Globalization;
using System.Linq;

namespace Codeforces
{
    internal static class Program
    {
        private static void Main()
        {
            var m = long.Parse(Console.ReadLine());
            var count = 0L;

            long i;
            for (i = 1; count < m; i++)
            {
                count = GetCount(i);
            }

            if (count == m)
            {
                Print(5);
                Print(string.Join(" ", Enumerable.Range(i, 5)));
            }
            else
            {
                Print(0);
            }
        }

        private static long GetCount(long n)
        {
            var count = 0L;
            for (var t = 5L; t <= n; t *= 5) { count += n / t; }
            return count;
        }

        private static void Print(string s) { Console.WriteLine(s); }
        private static void Print(long x) { Console.WriteLine(x.ToString(CultureInfo.InvariantCulture)); }
    }
}


using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        private void Solve()
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var k = int.Parse(s[1]);

            var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var sum = 0;
            var curr = 0;
            for (int i = 0; i < n; i++)
            {
                curr += arr[i];
                var t = Math.Min(8, curr);
                sum += t;
                if (sum >= k)
                {
                    Console.WriteLine(i+1);
                    return;
                }
                curr -= t;
            }
            Console.WriteLine(-1);
        }

        int BinarySearch(int[] arr, int q)
        {
            var l = 0;
            var r = arr.Length - 1;
            //int med = -1;
            while (l <= r)
            {
                var med = l + (r - l) / 2;
                if (arr[med] == q)
                {
                    return med;
                }
                if (q < arr[med])
                {
                    r = med - 1;
                }
                else
                {
                    l = med + 1;
                }
            }
            return -1;
        }

        static void Main(string[] args)
        {
            var p = new Program();
            p.Solve();
            //Console.ReadLine();
            //p.Dispose();

        }

        #region Helpers

        private static int ReadInt()
        {
            return int.Parse(textReader.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(textReader.ReadLine());
        }

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }

    public class TreeNode
    {
      public int val;
      public TreeNode left;
      public TreeNode right;
      public TreeNode(int x) { val = x; }
     }

}


        public static void  Main(string[] args)
        {
            string nk= Console.ReadLine();
            string astr = Console.ReadLine();
            int n = Convert.ToInt32(nk.Split(' ')[0]);
            int k = Convert.ToInt32(nk.Split(' ')[1]);
            int ind = 0,saved=0,given=0;
            for (int i=0; i< n;i++)
            {
               int aday= Convert.ToInt32((astr.Split(' ')[i]));
                if (aday > 8)
                {
                    saved += aday - 8;
                    aday = 8;
                }
                if (aday < 8 && saved > 0)
                {
                    while (aday <= 8 && saved > 0)
                    {
                        aday++;
                        saved--;
                    }
                }
                given += aday;
                ind += 1;
                if (given >= k)
                { Console.WriteLine(ind); return; }
            }
            Console.WriteLine(-1);

        }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double k;
            int l;
            Boolean a = false;
            k = Int32.Parse(Console.ReadLine());
            l = Int32.Parse(Console.ReadLine());
            int m = (int)k;
            if (k == l)
            {
                Console.WriteLine("YES");
                Console.WriteLine(0);
            }
           else if
            {
                for (int i = 1; i < 6911090; i++)
                {
                    k = k * m;
                    if (k >= l)
                    {
                        if (k == l)
                        {
                            Console.WriteLine("YES");
                            Console.WriteLine(i);
                            a = true;
                        }
                        break;
                    }
                    else if (k > l)
                        break;
                }
                if (a == false)
                    Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication15
{
    class Program
    {
        static void Main(string[] args)
        {
            Long k = long.Parse(Console.ReadLine());
            Long l = long.Parse(Console.ReadLine());

            int count = 0;
            for (long r = l; ; r /= k)
            {
                if (r < k)
                {
                    Console.WriteLine("NO");
                    break;

                }
                else if (r == k)
                {
                    Console.WriteLine("YES");
                    Console.WriteLine(count);

                    break;
                }
                count = ++count;
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double k;
            int l;
            Boolean a = false;
            k = Int32.Parse(Console.ReadLine());
            l = Int32.Parse(Console.ReadLine());
            int m = (int)k;
            if (k == l)
            {
                Console.WriteLine("YES");
                Console.WriteLine(0);
            }
           else
            {
                for (int i = 1; i < 6911090; i++)
                {
                    k = k * m;
                    if (k >= l)
                    {
                        if (k == l)
                        {
                            Console.WriteLine("YES");
                            Console.WriteLine(i);
                            a = true;
                        }
                        break;
                    }
                    else if (k > l)
                        break;
                }
                if (a == false)
                    Console.WriteLine("NO");
            }
            Console.Read();
        }
    }


using System;
ublic class Program
    {
        public static void Main(string[] args)
        {
            string[] input = Console.In.ReadToEnd().Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            double k = double.Parse(input[0]);
            double l = Math.Log(double.Parse(input[1]), k);
            if (l == Math.Truncate(l)) { Console.WriteLine("YES"); Console.WriteLine((l - 1D)); }
            else Console.WriteLine("NO");
        }
    }


sing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double k;
            int l;
            Boolean a = false;
            k = Int32.Parse(Console.ReadLine());
            l = Int32.Parse(Console.ReadLine());
            int m = (int)k;
            if (k == l)
            {
                Console.WriteLine("YES");
                Console.WriteLine(0);
            }
           else
            {
                for (int i = 1; i < 6911090; i++)
                {
                    k = k * m;
                    if (k >= l)
                    {
                        if (k == l)
                        {
                            Console.WriteLine("YES");
                            Console.WriteLine(i);
                            a = true;
                        }
                        break;
                    }
                    else if (k > l)
                        break;
                }
                if (a == false)
                    Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}


long k = long.Parse(Console.ReadLine());
            long l = long.Parse(Console.ReadLine());

                int count = 0;
                for(long r = l;;r/=k)
                {

                    count =++count;

                if(r%k!=0||r<k)
                {
                    Console.WriteLine("no");
                    Console.ReadKey();
                    break;

                }
                else if (r == k)
                {
                    Console.WriteLine("yes");
                    Console.WriteLine(count);
                    Console.ReadKey();
                    break;
                }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cifera_Mark_0
{
class Program
{

static void Main(string[] args)
{
int number = Int32.Parse(Console.ReadLine());
int power = Int32.Parse(Console.ReadLine());
int count = 0;
if (power != number && power % number == 0)
{
do
{
power /= number;
if (power % number == 0)
count++;
else
{
count = 0;
break;
}
}
while (power > number);
if (count > 0)
{
Console.WriteLine("YES");
Console.WriteLine(count);
}
else Console.WriteLine("NO");
}
else if (power == number)
{
Console.WriteLine("YES");
Console.WriteLine(count);
}
else Console.WriteLine("NO");
Console.ReadLine();

}
}
}.


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication6", "ConsoleApplication6\ConsoleApplication6.csproj", "{682DD499-BA25-4331-91EE-CB2AB06BFE89}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{682DD499-BA25-4331-91EE-CB2AB06BFE89}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;

namespace 1189A
{
    class Program
    {
        static void Main(string[] args)
        {

            int inputLength = int.Parse(Console.ReadLine());
            string inputNumber = Console.ReadLine();

            int j;
            int SplitAmmount = 0;
            bool istGut = false;
            List<string> splittedStrings = new List<string>();

            do
            {
                SplitAmmount++;
                splittedStrings.Clear();
                for(int i = 0; i<inputLength; i+= inputLength / SplitAmmount)
                {
                     splittedStrings.Add(inputNumber.Substring(i,inputLength/SplitAmmount));

                }

                istGut = TestForGood(splittedStrings.ToArray());
            } while (!istGut);

            Console.WriteLine(SplitAmmount);

            string finalString = string.Empty;

            foreach(var sstring in splittedStrings)
            {
                finalString += sstring + " ";
            }

            Console.WriteLine(finalString);
        }

        static bool TestForGood(string[] mainString)
        {
            foreach(var subString in mainString)
            {
                int j = -1000;
                var chars = subString.ToCharArray();

                foreach(var chara in chars)
                {
                    if (chara.ToString().Equals("0"))
                    {
                        j++;
                    }
                    else
                    {
                        j--;
                    }
                }
                j += 1000;
                if (j == 0)
                {
                    //ist schlecht
                    return false;
                }
            }
            // ist gut
            return true;
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KianuRivz", "KianuRivz\KianuRivz.csproj", "{D36CE70E-AACF-4EA7-8E02-B54807B0F041}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{D36CE70E-AACF-4EA7-8E02-B54807B0F041}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{D36CE70E-AACF-4EA7-8E02-B54807B0F041}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{D36CE70E-AACF-4EA7-8E02-B54807B0F041}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{D36CE70E-AACF-4EA7-8E02-B54807B0F041}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {A735B18E-BF67-44B2-B683-2AC075F8283E}
	EndGlobalSection
EndGlobal


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.329
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "a", "a\a.csproj", "{CBFEABD5-FB3E-42E4-98A8-F172C8F71D94}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{CBFEABD5-FB3E-42E4-98A8-F172C8F71D94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{CBFEABD5-FB3E-42E4-98A8-F172C8F71D94}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{CBFEABD5-FB3E-42E4-98A8-F172C8F71D94}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{CBFEABD5-FB3E-42E4-98A8-F172C8F71D94}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {02962193-0A70-4443-BFFD-BE7E7C93A88C}
	EndGlobalSection
EndGlobal


using System;
class a
{
    static void Main()
    {
        var s = Console.ReadLine();
        string p = "";
        for (int i = 0; i < s.Length; i++) if (s[i] == 'Q' || s[i] == 'A') p += s[i];
        int r = 0;
        if(p == "QAQ")
        {
            Console.WriteLine(1);
            return;
        }
        for (int i = 0; i < p.Length; i++)
        {
            string temp = p;
            temp = R(temp, i);
            if (Q(temp)) r++;
        }
        Console.WriteLine(r);
        bool Q(string x)
        {
            int q1 = x.IndexOf('Q');
            int a = x.IndexOf('A');
            if (a < 0) return false;
            int q2 = a + x.Substring(a, x.Length - a).IndexOf('Q') + 1;
            return (q1 < a && a < q2);
        }
        string R(string x, int index)
        {
            x = x.Substring(0, index) + "*" + x.Substring(index + 1, x.Length - index -1);
            return x;
        }
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{FA2037DF-B604-4BF9-AB69-1AA2F65EE5B9}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>UnimodalArray</RootNamespace>
    <AssemblyName>UnimodalArray</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


using System;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text.RegularExpressions;

//831A. Унимодальный массив

namespace CodeForces
{

    class Program
    {
        bool Down(int n, int v)
        {
            while (n-- != 0)
            {
                int w = cin.gi();
                if (w >= v) return false;
                v = w;
            }
            return true;
        }

        bool Flat(int n, int v)
        {
            while (n-- != 0)
            {
                int w = cin.gi();
                if (w > v) return false;
                if (w < v) return Down(n, w);
                v = w;
            }
            return true;
        }

        bool Up(int n, int v)
        {
            while (n-- != 0)
            {
                int w = cin.gi();
                if (w == v) return Flat(n, w);
                if (w < v) return Down(n, w);
                v = w;
            }
            return true;
        }

        private void solve()
        {
            Console.WriteLine(Up(cin.gi(), 0) ? "YeS" : "nO");
        }

        static void Main()
        {
            Program app = new Program();
            app.solve();
#if DEBUG
            Console.ReadKey(true);
#endif
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace CodeForces
{
	public class A
	{
		static void Main()
		{
			var n = int.Parse( Console.ReadLine() );
			if ( n == 1 )
			{
				Console.WriteLine( 0 );
				return;
			}
			var lst = new List<int>();
			var res = int.MaxValue;
			for ( var i = 1; i < n; ++i )
			{
				lst.Add( i );
				var x = i;
				var cur = 0;
				var y = n;
				while ( x > 0 && y > 0 )
				{
					if ( x > y )
					{
						cur += x / y;
						x %= y;
					}
					else
					{
						cur += y / x;
						y %= x;
					}
				}
				if ( x + y == 1 )
					res = Math.Min( res, cur );
			}

			var test = lst.Where( x => x % 5 == 1 ).OrderBy( x => x % 10 ).Take( 4 );

			var set = new HashSet<string>();
			var set2 = new SortedSet<string>();

			foreach ( var k in Enumerable.Range( 1, 1000000 ) )
			{
				set.Add( k.ToString() );
				set2.Add( k.ToString() );
			}

			foreach ( var k in Enumerable.Range( 1, 1000000 ) )
			{
				set.Add( k.ToString() );
				set2.Add( k.ToString() );
			}

			var view = set2.GetViewBetween( "100", "10000" );

			if ( test.Any( x => x == res ) )
			{
				Console.WriteLine( res - 1 );
			}
			else
			{
				Console.WriteLine( res - 1 );
			}
		}
	}
}


using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
    public static void Main()
    {
        // your code goes here
        int n = int.Parse(Console.ReadLine());
        var arrA = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToList();
        var arrB = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToList();
        Dictionary<string,bool> dict = new Dictionary<string,bool>();
        bool ok = false;
        int currentpos = 1;
        while(true){
            if(currentpos == arrA.Count){
                Console.WriteLine((currentpos - 1) + " " + 2);
                //Console.WriteLine();
                ok = true;
                break;
            }
            if(currentpos == arrB.Count){
                Console.WriteLine((currentpos - 1) + " " + 1);
                ok = true;
                break;
            }
            var str = getKey(arrA,currentpos,arrB);
            Console.WriteLine(str);
            if(dict.ContainsKey(str)){
                //Console.WriteLine(str);
                Console.WriteLine(-1);
                ok = true;
                break;
            }
            if(arrA[currentpos] > arrB[currentpos]){
                arrA.Add(arrB[currentpos]);
                arrA.Add(arrA[currentpos]);
            }else{
                arrB.Add(arrA[currentpos]);
                arrB.Add(arrB[currentpos]);
            }
            dict.Add(str,true);
            currentpos++;
        }

    }

    static string getKey(List<int> arrA , int startPos , List<int> arrB){
        string key = string.Empty;
        for(int i = startPos ; i < arrA.Count ; i++){
            key += arrA[i];
        }
        key + "X";
        for(int i = startPos ; i < arrB.Count ; i++){
            key += arrB[i];
        }
        return key;
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
namespace mono
{
	public class Program
	{
		public static void Main(string[] args)
		{
			int n  = int.Parse(Console.ReadLine());
        var array1 = Console.ReadLine().Split(' ');
        List<int> list = new List<int>[];
        List<int> list1 = new List<int>[];
        for(int i=0;i<n;++i)
        {
        	list.Add(int.Parse(array1[i]));
        }
        bool[] mark = new bool[list.Max()+1];
        for(int i=0;i<list.Max();++i)mark[i] = false;

        for(int i = 0;i<list.Count;++i)
        {
        	//Console.WriteLine(list[i]);
        	if(mark[list[i]] == false)
        	{
        		mark[list[i]] = true;
        		list1.Add(list[i]);
        	}
        }
        Console.WriteLine(list1.Count);
        foreach(var item in list1)
        {
        	Console.Write(item+" ");
        }
			//Console.ReadKey(true);
		}
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace C0deforces
{
    class DiverseTeam_486Div3
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("CodeForces");
            DiverseTeam_486Div3.distinctScores();
            //Console.ReadKey();
        }
        public static void distinctScores()
        {
            int[] NandK = Array.ConvertAll(Console.ReadLine().Trim().Split(' '),int.Parse);
            int[] input = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), int.Parse);
            Dictionary<int, int> indexDistinct = new Dictionary<int, int> { };
            bool diverse = false;
            for (int i = 0; i < NandK[0]; i++)
            {
                if (!indexDistinct.ContainsKey(input[i])) { indexDistinct.Add(input[i], i+1); }
                if (indexDistinct.Count == NandK[1]) { diverse = true; break; }
            }
            if (diverse)
            {
                Console.WriteLine("Yes");
                int[] output = indexDistinct.Values.ToArray();
                Console.WriteLine(string.Join(' ',output));
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


using System;
using System.Linq;

namespace ConsoleApplication18
{
    internal class Program
    {
        public static void Main(string[] args)
        {

            if(Console.ReadLine() == 2) Console.WriteLine(2);
            else Console.WriteLine(1);
        }
    }
}


int n = int.Parse(Console.ReadLine());
            for (int i = n - 1; i > 1; i--)
            {
                if (n % i != 0 && n != 1)
                {
                    n -= i;
                }
            }
            Console.WriteLine(n);


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Factorial
{
    class Program
    {
        public long Factorial(long a) { long product = 1; for (int i = 1; i <= a; i++) product *= i; return product; }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long[] a = new long[s.Length]; for (int i = 0; i < a.Length; i++) a[i] = Convert.ToInt64(s[i]);
            Program p = new Program();
            int t = Math.Min(a, b);
            Console.WriteLine(p.Factorial(t));
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Factorial
{
    class Program
    {
        public long Factorial(long a) { long product = 1; for (int i = 1; i <= a; i++) product *= i; return product; }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long[] a = new long[s.Length]; for (int i = 0; i < a.Length; i++) a[i] = Convert.ToInt64(s[i]);
            Program p = new Program();
            long t = Math.Min(a, b);
            Console.WriteLine(p.Factorial(t));
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.Valued_Keys
{
    class Program
    {
        static void Main(string[] args)
        {
            string x = Console.ReadLine();
            string y = Console.ReadLine();
            bool check = false;
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] < y[i])
                {
                    check = true;
                    break;
                }
            }
            if (check == true)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(y);
            }


internal class Program
    {
        static void Main(string[] args)
        {
            var i = Convert.ToInt64(Console.ReadLine());
            if (i == 3)
                i = 24;
            else
            {
                long q = 0;
                for (var k = 0; k < i - 1; ++k)
                {
                    if (k == 0 || k == i - 2)
                    {
                        q += (long)Math.Pow(4,i - 3) * 3;
                    }
                    else
                    {
                        q += (long)Math.Pow(4, (i - 4)) * 9;
                    }
                }

                i = q * 4;
            }
            Console.WriteLine(i);
        }
    }


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
    static void Main(String[] args) {
        var N = Convert.ToInt32(Console.ReadLine());
        var weights = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();
        var total= weights.Sum();
        var hund= weights.Count(weights=>{return weights==100;});
        var twohund= weights.Count(weights=>{return weights==200;});
        if(hund==0){
            if(twohund%2==0 && twohund!=0){
                Console.WriteLine("YES");

            }else{
                Console.WriteLine("N0");

            }
        }else if(twohund==0){
            if(hund%2==0 && hund!=0){
                Console.WriteLine("YES");

            }else{
                Console.WriteLine("N0");

            }
        }else{
            if(total%2!=0){
                Console.WriteLine("N0");

            }else{
                if(twohund%2==0 && hund%2==0){
                    Console.WriteLine("YES");

                }
                if( hund%2==1){
                    Console.WriteLine("NO");

                }
            }

        }
    }
}

// }
// class Solution {
//     static void Main(String[] args) {
//         var N = Convert.ToInt32(Console.ReadLine());
//         var Ns = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();
//         var total= Ns.Sum();
//         var minSum=int.MaxValue;
//         var leftsum=Ns[0];
//         var rightSum=total-leftsum;
//         for(int i=1;i<N;i++){

//             var sum=Math.Abs(leftsum-rightSum);
//             if(sum<minSum){
//                 minSum=sum;
//             }
//             leftsum+=Ns[i];
//             rightSum-=Ns[i];
//         }
//         Console.WriteLine(minSum);
//     }
// }
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;

// // /matrix roations
// // make all roations and overlao them
// // or
// // each point is also influcend by 4 other points
// // drax some pictures to figure oit out

// // use Except toget diffrence between strings
// // if it is only only one than it is code
// class Solution
// {
//     static void Main(String[] args)
//     {
//         int N = Convert.ToInt32(Console.ReadLine().Trim());
//         string specialW = Console.ReadLine().Trim();

//         var words=new List<string>();
//         for(int i=0;i<N;i++){
//             words.Add(Console.ReadLine().Trim());
//         }

//         Console.WriteLine(words.Count((word)=>{
//             //one letter change
//             if(Math.Abs(specialW.Length-word.Length)>1){
//                 return false;
//             }
//             if(specialW.Length==word.Length){
//                 int wrong=0;
//                 for(int i=0;i<specialW.Length;i++){
//                     if(specialW[i]!=word[i])wrong++;
//                     if(wrong>1){return false;}
//                 }
//                 return true;
//             }else
//             //missing letter
//             if(specialW.Length>word.Length){
//                 for(int i=0;i<specialW.Length;i++){
//                     if(i>word.Length-1){
//                         word+=specialW[i];
//                         if(specialW==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                     if(specialW[i]!=word[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         word=word.Insert(i,Char.ToString(specialW[i]));
//                         if(specialW==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;

//             }else{
//                 for(int i=0;i<word.Length;i++){
//                     if(i>specialW.Length-1){
//                         string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());

//                         specialWcopy+=word[i];
//                         if(specialWcopy==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                     if(specialW[i]!=word[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());
//                         specialWcopy=specialWcopy.Insert(i,word[i].ToString());
//                         if(specialWcopy==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;
//             }

//         }));

//     }
//}
// /matrix roations
// make all roations and overlao them
// or
// each point is also influcend by 4 other points
// drax some pictures to figure oit out

// use Except toget diffrence between strings
// if it is only only one than it is code
// class Solution
// {
//     static void Main(String[] args)
//     {
//         int N = Convert.ToInt32(Console.ReadLine().Trim());
//         List<char?>  specialW = Console.ReadLine().Trim().Select(word=>(char?)word).ToList();

//         var words=new List<string>();
//         for(int i=0;i<N;i++){
//             words.Add(Console.ReadLine().Trim());
//         }

//         Console.WriteLine(words.Count((word)=>{
//             //one letter change
//             if(specialW.Count==word.Length){
//                 int wrong=0;
//                 for(int i=0;i<specialW.Count;i++){
//                     if(specialW[i]!=word[i])wrong++;
//                     if(wrong>1){return false;}
//                 }
//                 return true;
//             }else
//             //missing letter
//             if(specialW.Count>word.Length){
//                 List<char?> nullableWord=word.Select(word=>(char?)word).ToList();
//                 for(int i=0;i<specialW.Count;i++){
//                     if(i>nullableWord.Count-1){
//                         nullableWord.Append(null);
//                     }
//                     if(specialW[i]!=word?[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         word=word.Insert(i,Char.ToString((char)specialW[i]));
//                         if(specialW==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;

//             }else{
//                 for(int i=0;i<word.Length;i++){
//                     if(specialW?[i]!=word[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());
//                         specialWcopy=specialWcopy.Insert(i,word[i].ToString());
//                         if(specialWcopy==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;
//             }

//         }));

//     }
//}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
    static void Main(String[] args) {
        var N = Convert.ToInt32(Console.ReadLine());
        var weights = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();
        var total= weights.Sum();
        var hund= weights.Count(weights=>{return weights==100;});
        var twohund= weights.Count(weights=>{return weights==200;});
        weights.Sort();
        for(int i=0;i<N;i++){
            if(weights.GetRange(0,i).Sum()==weights.GetRange(i,N-i).Sum()){
                Console.WriteLine("YES");
                return;
            }
        }
        Console.WriteLine("NO");

    }
}
// }
// class Solution {
//     static void Main(String[] args) {
//         var N = Convert.ToInt32(Console.ReadLine());
//         var Ns = Console.ReadLine().Split().Select(s => Convert.ToInt32(s)).ToList();
//         var total= Ns.Sum();
//         var minSum=int.MaxValue;
//         var leftsum=Ns[0];
//         var rightSum=total-leftsum;
//         for(int i=1;i<N;i++){

//             var sum=Math.Abs(leftsum-rightSum);
//             if(sum<minSum){
//                 minSum=sum;
//             }
//             leftsum+=Ns[i];
//             rightSum-=Ns[i];
//         }
//         Console.WriteLine(minSum);
//     }
// }
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;

// // /matrix roations
// // make all roations and overlao them
// // or
// // each point is also influcend by 4 other points
// // drax some pictures to figure oit out

// // use Except toget diffrence between strings
// // if it is only only one than it is code
// class Solution
// {
//     static void Main(String[] args)
//     {
//         int N = Convert.ToInt32(Console.ReadLine().Trim());
//         string specialW = Console.ReadLine().Trim();

//         var words=new List<string>();
//         for(int i=0;i<N;i++){
//             words.Add(Console.ReadLine().Trim());
//         }

//         Console.WriteLine(words.Count((word)=>{
//             //one letter change
//             if(Math.Abs(specialW.Length-word.Length)>1){
//                 return false;
//             }
//             if(specialW.Length==word.Length){
//                 int wrong=0;
//                 for(int i=0;i<specialW.Length;i++){
//                     if(specialW[i]!=word[i])wrong++;
//                     if(wrong>1){return false;}
//                 }
//                 return true;
//             }else
//             //missing letter
//             if(specialW.Length>word.Length){
//                 for(int i=0;i<specialW.Length;i++){
//                     if(i>word.Length-1){
//                         word+=specialW[i];
//                         if(specialW==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                     if(specialW[i]!=word[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         word=word.Insert(i,Char.ToString(specialW[i]));
//                         if(specialW==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;

//             }else{
//                 for(int i=0;i<word.Length;i++){
//                     if(i>specialW.Length-1){
//                         string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());

//                         specialWcopy+=word[i];
//                         if(specialWcopy==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                     if(specialW[i]!=word[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());
//                         specialWcopy=specialWcopy.Insert(i,word[i].ToString());
//                         if(specialWcopy==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;
//             }

//         }));

//     }
//}
// /matrix roations
// make all roations and overlao them
// or
// each point is also influcend by 4 other points
// drax some pictures to figure oit out

// use Except toget diffrence between strings
// if it is only only one than it is code
// class Solution
// {
//     static void Main(String[] args)
//     {
//         int N = Convert.ToInt32(Console.ReadLine().Trim());
//         List<char?>  specialW = Console.ReadLine().Trim().Select(word=>(char?)word).ToList();

//         var words=new List<string>();
//         for(int i=0;i<N;i++){
//             words.Add(Console.ReadLine().Trim());
//         }

//         Console.WriteLine(words.Count((word)=>{
//             //one letter change
//             if(specialW.Count==word.Length){
//                 int wrong=0;
//                 for(int i=0;i<specialW.Count;i++){
//                     if(specialW[i]!=word[i])wrong++;
//                     if(wrong>1){return false;}
//                 }
//                 return true;
//             }else
//             //missing letter
//             if(specialW.Count>word.Length){
//                 List<char?> nullableWord=word.Select(word=>(char?)word).ToList();
//                 for(int i=0;i<specialW.Count;i++){
//                     if(i>nullableWord.Count-1){
//                         nullableWord.Append(null);
//                     }
//                     if(specialW[i]!=word?[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         word=word.Insert(i,Char.ToString((char)specialW[i]));
//                         if(specialW==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;

//             }else{
//                 for(int i=0;i<word.Length;i++){
//                     if(specialW?[i]!=word[i]){
//                         //this should be the index of the missing letter
//                         //replace the word with a value that includes the missing letter
//                         string specialWcopy=new String(specialW.Select((letter)=>letter).ToArray());
//                         specialWcopy=specialWcopy.Insert(i,word[i].ToString());
//                         if(specialWcopy==word){
//                             return true;
//                         }else{
//                             return false;
//                         }
//                     }
//                 }
//                 return true;
//             }

//         }));

//     }
//}


using System;

namespace trafficelights
{
	class MainClass
	{
		public static void Main (string[] args)
		{
            string wkstr = Console.ReadLine();
            string[] a = wkstr.Split(' ');
			double l = Int32.Parse(a[0]);
			double d = Int32.Parse(a[1]);
			double v = Int32.Parse(a[2]);
			double g = Int32.Parse(a[3]);
			double r = Int32.Parse(a[4]);
			double ret = l/v;
			double t1 = d/v;
			int wk = Math.Floor(t1 / (g+r));
			double amari = t1 - wk*(g+r);
//			double amari = (d/v) % (g+r);
			if (amari >= g) {
				ret += (g+r-amari);
			}
			Console.WriteLine (ret.ToString("F8"));
		}
	}
}


using System;
using System.Collections.Generic;
using System.Text;

public class DieRoll
{
    public DieRoll()
    {
        int A = 0;
        int B = 0;
        string[] str = Console.ReadLine().Split(' ');

        A = Convert.ToInt32(str[0]);
        B = Convert.ToInt32(str[1]);

        A = A > B ? A : B;
        A = 7 - A;
        B = GetGCD(6, A);
        Console.Write((A / B) + "/" + (6 / B));
    }

    //A>B
    public int GetGCD(int A, int B)
    {
        int gcd = 0;
        if (A % B == 0)
        {
            gcd = B;
        }
        else
        {
            gcd = GetGCD(B, A % B);
        }
        return gcd;
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int Y;
            int W;
            int Max;
            var line = Console.ReadLine();
            Y = Convert.ToInt32(line.Split(' ')[0]);
            W = Convert.ToInt32(line.Split(' ')[2]);
            Max = Y;
            if (W > Max)
            {
                Max = W;
            }
            Max = 6 - Max + 1;
            if (Max == 1 || Max == 5)
            {

                Console.WriteLine($"{Max}/6\n");
            }
            else if (Max == 2 || Max == 4)
            {
                Console.WriteLine($"{Max/2}/3\n");
            }
            else if (Max == 3)
            {

                Console.WriteLine("1/2\n");
            }
            else
            {
                Console.Write("1/1\n");
            }
            return;
        }
    }
}


using System;
 class Program
{
   static void Main(string[]args)
    {
        int[] YWResult = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            int dotChances = (6 - YWResult.Max()) + 1;

            if(dotChances == 6)
                Console.WriteLine("6/6");
            else
            {
                if(dotChances % 2 ==0)
                {
                    Console.WriteLine(dotChances / 2+"/"+3);
                }
                else if(dotChances % 5==0)
                {
                    Console.WriteLine(dotChances+"/"+6);
                }
                else
                {
                    Console.WriteLine(dotChances / 3+"/"+2);
                }
            }
    }

}


using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
using System.Numerics;

class Solution
{
    static void Main(string[] args)
    {

        string[] roll = {"1/6","1/3","1/2","2/3","5/6","1/1"};
        var input = Console.ReadLine().Split(" ");
        int max = Math.Max(Convert.ToByte(input[0]), Convert.ToByte(input[1]));
        Console.WriteLine(roll[6 - max]);
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CheckCable
{
    class Program
    {

        static void Main(string[] args)
        {
            //Questions.Question1_CharacterOccurences();
            //Questions.Question2_LinearGenerator();
            //Questions.Question3_CheckingCable();
            Questions.Question1_AmrAndMusic();
        }
        public static void Question1_AmrAndMusic()
        {
            // 1. Init
            int n, k;
            string[] firstline = Console.ReadLine().Split(' ');
            n = Convert.ToInt32(firstline[0]);// number of instruments
            k = Convert.ToInt32(firstline[1]);// number of days
            // The second line contains n integers a.i (1 ≤ ai ≤ 100), representing number of days required to learn the i-th instrument.
            int[] instrument_learning_days = new int[n];
            string[] secondline = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                instrument_learning_days[i] = Convert.ToInt32(secondline[i]);
            }

            // 2. Processing
            int[] IndexArray = new int[n];
            for(int i=0; i<n; i++)
            {
                IndexArray[i] = i;
            }
            MergeSort(ref instrument_learning_days, ref IndexArray, 0, n-1);

            int tempIndex = 0;
            int TotalDays = 0;
            bool HaveResult = false;
            while (tempIndex < n)
            {
                TotalDays += instrument_learning_days[tempIndex];
                if (TotalDays > k)
                {
                    break;
                }
                HaveResult = true;
                tempIndex++;
            }

            if (!HaveResult)
                Console.WriteLine(0);
            else
            {
                Console.WriteLine(tempIndex);
                Console.Write(IndexArray[0]+1);
                for (int i = 1; i < tempIndex; i++)
                {
                    Console.Write(string.Format(" {0}", IndexArray[i]+1));
                }
                Console.WriteLine();
            }
            int ad= 1;
        }

        public static void MergeSort(ref int[] InputString, ref int[] IndexArray, int HeadIndex, int TailIndex)
        {
            if (HeadIndex == TailIndex)
                return;
            int MiddleIndex = (HeadIndex + TailIndex) / 2;
            MergeSort(ref InputString, ref IndexArray, HeadIndex, MiddleIndex);
            MergeSort(ref InputString, ref IndexArray, MiddleIndex + 1, TailIndex);
            Merge(ref InputString, ref IndexArray, HeadIndex, MiddleIndex, TailIndex);

        }

        private static void Merge(ref int[] InputString, ref int[] IndexArray, int Head, int Middle, int Tail)
        {
            int currentIndex = Head;
            int LeftIndex = Head;
            int RightIndex = Middle + 1;
            int[] TempArray = new int[InputString.Length];
            Array.Copy(InputString, 0, TempArray, 0, InputString.Length);

            int[] TempIndexArray = new int[IndexArray.Length];
            Array.Copy(IndexArray, 0, TempIndexArray, 0, TempIndexArray.Length);
            while (LeftIndex <= Middle && RightIndex <= Tail)
            {
                if (TempArray[LeftIndex] < TempArray[RightIndex])
                {
                    IndexArray[currentIndex] = TempIndexArray[LeftIndex];
                    InputString[currentIndex++] = TempArray[LeftIndex++];
                }
                else
                {
                    IndexArray[currentIndex] = TempIndexArray[RightIndex];
                    InputString[currentIndex++] = TempArray[RightIndex++];
                }
            }

            while (LeftIndex <= Middle)
            {
                IndexArray[currentIndex] = TempIndexArray[LeftIndex];
                InputString[currentIndex++] = TempArray[LeftIndex++];
            }
            while (RightIndex <= Tail)
            {
                IndexArray[currentIndex] = TempIndexArray[RightIndex];
                InputString[currentIndex++] = TempArray[RightIndex++];
            }
        }
    }
}


        public static int CountSums(List<long> list, long maxb, long minb)
        {
            int count = 0;
            var suit1 = new HashSet<long>();
            for (var i = 0; i < list.Count; i++)
            {
                var t = list[i];
                var res = BinarySearch(list, x =>
                {
                    var dop = x + t;
                    if (dop > maxb)
                        return dop - maxb;
                    if (dop < minb)
                        return dop - minb;
                    return 0;
                }, i);
                if (res == -1) continue;
                if (res == i && (list[res + 1] != list[res] || list[res - 1] != list[res]))
                    continue;
                suit1.Add(list[i]);
            }
            var suit = suit1.ToList();
            suit.Sort();
            var hash = new HashSet<long>();
            var added = new HashSet<long>();
            for (var i = minb; i <= maxb; ++i)
                hash.Add(i);
            var max = maxb;
            var min = minb;
            for (int j = 0; j < suit.Count; j++)
            {
                var t = suit[j];
                int res = 1;
                while (res != -1)
                {
                    res = BinarySearch(suit, x =>
                    {

                        var dop = x + t;
                        if (dop < min)
                            return dop - min;
                        if (dop > max)
                            return dop - max;
                        return 0;
                    }, j);
                    if (res != -1 && !hash.Contains(t + suit[res]))
                    {
                        res = BinarySearch(suit, x =>
                        {
                            var dop = x + t;
                            if (hash.Contains(dop))
                                return 0;
                            if (dop > max)
                                return dop - max;
                            return dop - min;

                        }, j);
                        if (res == -1 || !hash.Contains(t + suit[res]))
                            res = BinarySearch(suit, x =>
                            {
                                var dop = x + t;
                                if (hash.Contains(dop))
                                    return 0;
                                if (dop < min)
                                    return dop - min;
                                return dop - max;
                            }, j);
                    }
                    if (res != -1 && res != j)
                    {
                        //if (suit[res] + t == max)
                        //    max--;
                        //if (suit[res] + t == min)
                        //    min++;
                        hash.Remove(t + suit[res]);
                        added.Add(t + suit[res]);
                        count++;
                    }
                }
            }
            return count;
        }
        public static int func(int p, int n, int k = 0)
        {
            return (p * n - 1 + k) / (p - 1);
        }

        private static List<bool> marked;
        private static List<int> f;
        private static int t = 0;

        public static List<Pair> countSCP(Graph g)
        {
            g.Reverse();
            DFSLoop(g);
            g.Reverse();
            for (int i = 0; i < g.v.Length; ++i)
                g.v[f[i]] = i;
            return DFSLoop(g);
        }
        public static List<Pair> DFSLoop(Graph g)
        {
            t = 0;
            var leaders = new List<Pair>();
            marked = Enumerable.Repeat(false, g.v.Length).ToList();
            f = Enumerable.Repeat(0, g.v.Length).ToList();
            for (int i = g.v.Length - 1; i > -1; --i)
                if (!marked[g.v[i]])
                {
                    int w = t;
                    DFS(g, g.v[i]);
                    leaders.Add(new Pair { f = i, s = t - w });
                }
            return leaders;
        }
        public static void DFS(Graph g, int node)
        {
            marked[node] = true;
            var cross = g.mapped[node];
            if (cross == null) return;
            foreach (var i in cross.Where(i => !marked[i]))
            {
                DFS(g, i);
            }
            ++t;
            f[g.v[node]] = t - 1;
        }

        public static int[] Dijkstra(Graphv2 g)
        {
            var a = new Dictionary<int, int>();
            var x = new List<int>();
            int p = 0;
            var l = g.l;
            var v = g.v;
            var e = g.e;
            x.Add(0);
            a[0] = 0;
            while (x.Count != g.v.Length)
            {
                int min = -1;
                var mini = -1;
                bool first = true;
                foreach (var i in x)
                {
                    foreach (var k in g.mapped[i])
                    {
                        if (x.IndexOf(k) != -1)
                            continue;
                        int r = a[i] + l[i, k];
                        if (first)
                        {
                            first = false;
                            min = r;
                            mini = k;
                        }
                        else if (r < min)
                        {
                            min = r;
                            mini = k;
                        }
                    }

                }
                x.Add(mini);
                a[mini] = min;

            }
            var res = new int[v.Length];
            foreach (var i in a)
            {
                res[i.Key] = i.Value;
            }
            return res;
        }

        public static int BinarySearch(IList<long> list, Func<long, long> func, int except = -1)
        {
            int l = 0, r = list.Count - 1, i = (l + r) / 2;
            bool pass = except == -1;
            while (l < r)
            {
                if (r - l < 100)
                {
                    int k = 5;
                }
                var test = func(list[i]);
                if (test == 0)
                {
                    if (pass || except != i)
                        return i;
                    if (i != 0 && func(list[i - 1]) == 0)
                        return i - 1;
                    if (i != list.Count - 1 && func(list[i + 1]) == 0)
                        return i + 1;

                }
                if (test < 0)
                    l += (r - l + 1) / 2;
                else
                    r -= (r - l + 1) / 2;
                i = (l + r + 1) / 2;
            }
            return -1;
        }


using System;
using System.CodeDom;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            int n = arr[0];
            int k = arr[1];
            var inp =
                Console.ReadLine()
                    .Split(' ')
                    .Select(Int32.Parse)
                    .Select((x, ind) => new Tuple<int, int>(x, ind+1))
                    .ToArray();
            inp = inp.OrderBy(x => x.Item1).ToArray();
            int s = 0;
            int i = 0;
            while (i<n)
            {
                var dop = inp[i].Item1;
                if (s + dop <= k)
                {
                    s += dop;
                    ++i;
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(i);
            inp.Take(i).ToList().ForEach(x=>Console.Write("{0} ",x.Item2));
        }
        public static int CountSums(List<long> list, long maxb, long minb)
        {
            int count = 0;
            var suit1 = new HashSet<long>();
            for (var i = 0; i < list.Count; i++)
            {
                var t = list[i];
                var res = BinarySearch(list, x =>
                {
                    var dop = x + t;
                    if (dop > maxb)
                        return dop - maxb;
                    if (dop < minb)
                        return dop - minb;
                    return 0;
                }, i);
                if (res == -1) continue;
                if (res == i && (list[res + 1] != list[res] || list[res - 1] != list[res]))
                    continue;
                suit1.Add(list[i]);
            }
            var suit = suit1.ToList();
            suit.Sort();
            var hash = new HashSet<long>();
            var added = new HashSet<long>();
            for (var i = minb; i <= maxb; ++i)
                hash.Add(i);
            var max = maxb;
            var min = minb;
            for (int j = 0; j < suit.Count; j++)
            {
                var t = suit[j];
                int res = 1;
                while (res != -1)
                {
                    res = BinarySearch(suit, x =>
                    {

                        var dop = x + t;
                        if (dop < min)
                            return dop - min;
                        if (dop > max)
                            return dop - max;
                        return 0;
                    }, j);
                    if (res != -1 && !hash.Contains(t + suit[res]))
                    {
                        res = BinarySearch(suit, x =>
                        {
                            var dop = x + t;
                            if (hash.Contains(dop))
                                return 0;
                            if (dop > max)
                                return dop - max;
                            return dop - min;

                        }, j);
                        if (res == -1 || !hash.Contains(t + suit[res]))
                            res = BinarySearch(suit, x =>
                            {
                                var dop = x + t;
                                if (hash.Contains(dop))
                                    return 0;
                                if (dop < min)
                                    return dop - min;
                                return dop - max;
                            }, j);
                    }
                    if (res != -1 && res != j)
                    {
                        //if (suit[res] + t == max)
                        //    max--;
                        //if (suit[res] + t == min)
                        //    min++;
                        hash.Remove(t + suit[res]);
                        added.Add(t + suit[res]);
                        count++;
                    }
                }
            }
            return count;
        }
        public static int func(int p, int n, int k = 0)
        {
            return (p * n - 1 + k) / (p - 1);
        }

        private static List<bool> marked;
        private static List<int> f;
        private static int t = 0;

        public static List<Pair> countSCP(Graph g)
        {
            g.Reverse();
            DFSLoop(g);
            g.Reverse();
            for (int i = 0; i < g.v.Length; ++i)
                g.v[f[i]] = i;
            return DFSLoop(g);
        }
        public static List<Pair> DFSLoop(Graph g)
        {
            t = 0;
            var leaders = new List<Pair>();
            marked = Enumerable.Repeat(false, g.v.Length).ToList();
            f = Enumerable.Repeat(0, g.v.Length).ToList();
            for (int i = g.v.Length - 1; i > -1; --i)
                if (!marked[g.v[i]])
                {
                    int w = t;
                    DFS(g, g.v[i]);
                    leaders.Add(new Pair { f = i, s = t - w });
                }
            return leaders;
        }
        public static void DFS(Graph g, int node)
        {
            marked[node] = true;
            var cross = g.mapped[node];
            if (cross == null) return;
            foreach (var i in cross.Where(i => !marked[i]))
            {
                DFS(g, i);
            }
            ++t;
            f[g.v[node]] = t - 1;
        }

        public static int[] Dijkstra(Graphv2 g)
        {
            var a = new Dictionary<int, int>();
            var x = new List<int>();
            int p = 0;
            var l = g.l;
            var v = g.v;
            var e = g.e;
            x.Add(0);
            a[0] = 0;
            while (x.Count != g.v.Length)
            {
                int min = -1;
                var mini = -1;
                bool first = true;
                foreach (var i in x)
                {
                    foreach (var k in g.mapped[i])
                    {
                        if (x.IndexOf(k) != -1)
                            continue;
                        int r = a[i] + l[i, k];
                        if (first)
                        {
                            first = false;
                            min = r;
                            mini = k;
                        }
                        else if (r < min)
                        {
                            min = r;
                            mini = k;
                        }
                    }

                }
                x.Add(mini);
                a[mini] = min;

            }
            var res = new int[v.Length];
            foreach (var i in a)
            {
                res[i.Key] = i.Value;
            }
            return res;
        }

        public static int BinarySearch(IList<long> list, Func<long, long> func, int except = -1)
        {
            int l = 0, r = list.Count - 1, i = (l + r) / 2;
            bool pass = except == -1;
            while (l < r)
            {
                if (r - l < 100)
                {
                    int k = 5;
                }
                var test = func(list[i]);
                if (test == 0)
                {
                    if (pass || except != i)
                        return i;
                    if (i != 0 && func(list[i - 1]) == 0)
                        return i - 1;
                    if (i != list.Count - 1 && func(list[i + 1]) == 0)
                        return i + 1;

                }
                if (test < 0)
                    l += (r - l + 1) / 2;
                else
                    r -= (r - l + 1) / 2;
                i = (l + r + 1) / 2;
            }
            return -1;
        }
    }
}


using System;
using System.Linq;

namespace _507A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var n = s[0]; var k = s[1];
            var source = Console.ReadLine().Split().Select(int.Parse).ToArray();
            List<int> indices = new List<int>();
            var sorted = source.Select((x, i) => new { Days = x, Index = i}).OrderBy(x=>x.Days).ToList();
            for (int i=0;i<sorted.Count ;i++)
            {
                if (k >= sorted[i].Days) k -= sorted[i].Days;
                else break;
                indices.Add(sorted[i].Index);
            }
            Console.WriteLine(indices.Count);
            foreach (var i in indices) Console.Write(i + " ");
        }

    }
}


using System;
using System.IO;

namespace _378A
{
    class Program
    {
        static void Main(string[] args)
        {
            solve_378A();
        }

        public static void solve_378A()
        {
            string test = Console.ReadLine();
            string vowels = "AEIOUX";
            int count = 0;
            int max = 0;
            char prev = test[0];
            for (int i = 0; i < test.Length; i++)
            {
                if (vowels.Contains(test[i]) || i == test.Length - 1)
                {
                    max = Math.Max(max, (i == test.Length - 1) ? count + 2 : count + 1);
                    count = 0;
                }
                else
                {
                    count++;
                }
            }

            Console.WriteLine(max);
        }
    }
}


using System;
using System.Collections.Generic;

public class Program
{
    public static HashSet<char> vowels = new HashSet<char>(new string[] { 'A', 'E', 'I', 'O', 'U', 'Y' });

    public static void Main(string[] args)
    {
        var input = Console.ReadLine().ToUpper();

        var max = int.MinValue;
        var position = 0;

        while (position != input.Length)
        {
            var tuple = NextVowel(input, position);
            if (tuple == null)
            {
                break;
            }
            position = tuple.Item1;
            max = Math.Max(tuple.Item2, max);
        }

        Console.WriteLine(max);
    }

    public static Tuple<int, int> NextVowel(string text, int position)
    {
        for (var i = position; i < input.Length; i++)
        {
            if (vowels.Contains(text[i]))
            {
                return new Tuple<int, int>(i, (i + 1) - position);
            }
        }

        return new Tuple<int, int>();
    }
}


using System;
using System.Collections.Generic;

public class Program
{
    public static HashSet<char> vowels = new HashSet<char>(new string[] { 'A', 'E', 'I', 'O', 'U', 'Y' });

    public static void Main(string[] args)
    {
        var input = Console.ReadLine().ToUpper();

        var max = int.MinValue;
        var position = 0;

        while (position != input.Length)
        {
            var tuple = NextVowel(input, position);
            if (tuple.Item1 == -1)
            {
                break;
            }
            position = tuple.Item1;
            max = Math.Max(tuple.Item2, max);
        }

        Console.WriteLine(max);
    }

    public static Tuple<int, int> NextVowel(string input, int position)
    {
        for (var i = position; i < input.Length; i++)
        {
            if (vowels.Contains(text[i]))
            {
                return new Tuple<int, int>(i, (i + 1) - position);
            }
        }

        return new Tuple<int, int>(-1, -1);
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Grasshopper_And_the_String
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int sum = 0;
            List<int> li = new List<int>();
            for(int i=0;i<s.Length;i++)
            {
                if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')
                {
                    sum++; li.Add(sum); sum = 0;
                }
                else
                {
                    sum++;
                }
            }
            if(li.Count==0)
            {
                li.Add(sum);
            }
            li.Sort();
            Console.WriteLine(li[li.Count - 1]);
        }
    }
}


using System;
using System.Collections.Generic;

public class Program
{
    public static HashSet<char> vowels = new HashSet<char>(new string[] { 'A', 'E', 'I', 'O', 'U', 'Y' });

    public static void Main(string[] args)
    {
        var input = Console.ReadLine().ToUpper();

        var max = int.MinValue;
        var position = 0;

        while (position != input.Length)
        {
            var tuple = NextVowel(input, position);
            if (tuple.Item1 == -1)
            {
                break;
            }
            position = tuple.Item1;
            max = Math.Max(tuple.Item2, max);
        }

        Console.WriteLine(max);
    }

    public static Tuple<int, int> NextVowel(string input, int position)
    {
        for (var i = position; i < input.Length; i++)
        {
            if (vowels.Contains(input[i]))
            {
                return new Tuple<int, int>(i, (i + 1) - position);
            }
        }

        return new Tuple<int, int>(-1, -1);
    }
}


using System;

class Program
{
    static int Main()
    {
        int a, b, c;
        string []s = Console.ReadLine().Parse(' ');
        a = Convert.ToInt32(s[0]);
        b = Convert.ToInt32(s[1]);
        c = Convert.ToInt32(s[2]);
        Console.WriteLine(a * b * c - (a - 1) * (b - 1) * (c - 1));
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Preparation
{
    public class CodeForcesCompetition3B
    {
        public static void Main1(string[] args)
        {
            var str = Console.ReadLine();
            char[] output = new char[str.Length];
            int[] arr = new int[27];
            for (int i = 0; i < 27; ++i) arr[i] = -1;

            var list = new List<int>();

            for (int i = 0; i < str.Length; ++i)
            {
                if (str[i] == '?')
                {
                    list.Add(i);
                }
                else
                {
                    output[i] = str[i];
                    arr[str[i] - 'A'] = i;
                }

                if (Check(arr, i, list))
                {
                    int moa = 0;
                    for (int j = i; i-j < 26; j--)
                    {
                        if (str[j] != '?') continue;
                        for (; moa < 26; ++moa)
                        {
                            if (i - arr[moa] >= 26)
                            {
                                output[j] = (char)(moa + 'A');
                                moa++;
                                break;
                            }
                        }
                    }

                    for (int ii = 0; ii < output.Length; ++ii)
                    {
                        if (output[ii] == 0)
                            output[ii] = 'A';
                    }

                    Console.WriteLine(new string(output));

                    return;
                }
            }

            Console.WriteLine(-1);
        }

        public static bool Check(int[] arr, int cur, List<int> list)
        {
            int rc = 0;
            for (int i = list.Count - 1; i >= 0; i--)
            {
                if (cur - list[i] >= 26)
                    break;
                rc++;
            }

            int rc1 = 0;
            for (int i = 0; i < 26; ++i)
            {
                if (arr[i] == -1 || cur - arr[i] >= 26)
                    rc1++;
            }

            if (rc1 > rc)
                return false;
            return true;
        }
    }
}


using System;
using System.Linq;

namespace CodeForces
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string line1 = Console.ReadLine();
			int n = Int32.Parse(line1);
			int[,] columns = new int[11 , 4];
			if (n >= 4)
			{
				n -= 4;
				for (int i = 0; i < 4; i++)
				{
					columns[0, i] = 1;
				}
				int column = 1;
				int row = 0;
				while (n > 0)
				{
					n -= 1;
					columns[column, row] = 1;
					row += 1;
					if (row == 2)
					{
						row += 1;
					}
					if (row == 4)
					{
						row = 0;
						column += 1;
					}
				}
			}
			else
			{
				if (n == 3)
				{
					for (int i = 0; i < 3; i++)
					{
						columns[0, i] = 1;
					}
				}
				else if (n == 2)
				{
					for (int i = 0; i < 2; i++)
					{
						columns[0, i] = 1;
					}
				}
				else if (n == 1)
				{
					for (int i = 0; i < 1; i++)
					{
						columns[0, i] = 1;
					}
				}
				else
				{

				}
			}
			Console.WriteLine("+------------------------+");
			Console.Write("|");
			for (int i = 0; i < 11; i++)
			{
				if (columns[i, 0] == 1)
				{
					Console.Write("O.");
				}
				else
				{
					Console.Write("#.");
				}
			}
			Console.Write("|D|)" + Environment.NewLine);
			Console.Write("|");
			for (int i = 0; i < 11; i++)
			{
				if (columns[i, 1] == 1)
				{
					Console.Write("O.");
				}
				else
				{
					Console.Write("#.");
				}
			}
			Console.Write("|.|" + Environment.NewLine);
			Console.Write("|");
			for (int i = 0; i < 11; i++)
			{
				if (columns[i, 2] == 1)
				{
					Console.Write("O.");
				}
				else
				{
					if (i = 0)
					{
						Console.Write("#.);

					}
					else
					{
						Console.Write("..");
					}

				}
			}
			Console.Write("..|" + Environment.NewLine);
			Console.Write("|");
			for (int i = 0; i < 11; i++)
			{
				if (columns[i, 3] == 1)
				{
					Console.Write("O.");
				}
				else
				{
					Console.Write("#.");
				}
			}
			Console.Write("|.|)" + Environment.NewLine);
			Console.WriteLine("+------------------------+");

		}

	}

}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        private static void MyMain()
        {
            long n = RLong();

            long [] store = new long[n];
            for (long i = 1; i <= n; i++)
            {
                var x = n % i;
                if (x == 0)
                {
                    store[store.Length-1] = (n / i);
                }
            }

            for (long i = 0; i < store[]; i++)
            {
                bool flag = false;
                for (long j = 2; j < store[i]; j++)
                {
                    if (store[i] % (j * j) == 0)
                    {

                        flag = true;
                        break;
                    }
                }
                if (flag == false)
                {
                    WLine(store[i]);
                    return;
                }
            }
        }

        static void Main()
        {
#if !HOME
            MyMain();
#else
            var tmp = Console.In;
            Console.SetIn(new StreamReader("in.txt"));
            while (Console.In.Peek() > 0)
            {
                MyMain();
            }
            Console.In.Close();
            Console.SetIn(tmp);
            Console.ReadKey();
#endif
        }

        #region Utils
        static string RLine()
        {
            return Console.ReadLine();
        }

        static int RInt()
        {
            var str = Console.ReadLine();
            return Convert.ToInt32(str);
        }

        static long RLong()
        {
            var str = Console.ReadLine();
            return Convert.ToInt64(str);
        }

        static int[] RInts()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));
        }

        static void RInts(out int a, out int b)
        {
            var ints = RInts();
            a = ints[0];
            b = ints[1];
        }

        static void WLine<T>(T s)
        {
            Console.WriteLine(s);
        }
        #endregion
    }
}


using System;

public class Coins
{
    private static void Main()
    {

            const int max = 1000;
            int n = Convert.ToInt32(Console.ReadLine());
            int[] primes = new int[max + 1];
            primes[1] = 2;
            primes[2] = 3;
            int curr_prime = 3;
            int sqrt = 1;
            for (int i = 4; (curr_prime <= max && i < Int32.MaxValue); i++)
            {
                if ((sqrt + 1) * (sqrt + 1) == i)
                    sqrt++;

                bool f = true;
                for (int j = 1; primes[j] <= sqrt; j++)
                {
                    if (i % primes[j] == 0)
                    {
                        f = false;
                        break;
                    }
                }

                if (f)
                {
                    primes[curr_prime] = i;
                    curr_prime++;
                }
            }

            bool f = true;
            while (n > 1 && f)
            {
                sqrt = (int)Math.Sqrt(n);
                f = false;
                for (int i = 1; primes[i] <= n; i++)
                {
                    if (n % primes[i] == 0)
                    {
                      Console.WriteLine(primes[i].ToString());
                      n /= primes[i];
                      f = true;
                      break;
                    }
                }
            }
                                  Console.WriteLine(primes[0].ToString());

    }
}


<Query Kind="Program" />

void Main()
{
	int n =int.Parse(Console.ReadLine());

	string[] game = Console.ReadLine().Split();
	int[]  ans = new int [n];

	for (int k=0;k<n;k++)
	{
		if (k>0) ans[k] = ans[k-1];
		if (game[k]=="0") ans[k]++;
	}
	int max = 0;
	int t = 0;

	for (int i =0;i<n;i++)
	{
		t= 1;
		if (i<n-1) t+=n-ans[n-1] - (i+1-ans[i]);
		if (i>0) t+= ans[i-1];
		if (max<t)
			max = t;
	}
	Console.WriteLine(max);
}

// Define other methods and classes here


public class CodeForces
{
#if TEST
// To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
const bool testing = true;
#else
const bool testing = false;
#endif

static void program(TextReader input) {

}

public static void Main(string[] args){
	if(!testing){ // set testing to false when submiting to codeforces
		program(Console.In); // write your program in 'program' function (its your new main !)
		return;
	}

Console.WriteLine("Test Case(1) => expected :");
Console.WriteLine("2\n");
Console.WriteLine("Test Case(1) => found    :");
program(new StringReader("19 29\n"));
Console.WriteLine();

Console.WriteLine("Test Case(2) => expected :");
Console.WriteLine("3\n");
Console.WriteLine("Test Case(2) => found    :");
program(new StringReader("3 6\n"));
Console.WriteLine();

}
}


using System;

class program
{
    int g(long c)
    {
        if(c==0)
            return 0;
        else
            return 1;
    }
    static void main()
    {
        var inp =Console.ReadLine().Split(' ');
        long l =Convert.ToInt64(inp[0]);
        long r =Convert.ToInt64(inp[1]);
        if(l==r)
        {
            Console.Write(l);
            return;
        }
        Console.Write(r/2 - l/2 - g(l%2));
    }
}


using System;

class Programm
{
    static void Main(string[] args){
        string arg = Console.ReadLine();
        string[] ns = arg.Split(' ');
        if(ns[0].Empty(ns[1]))Console.WriteLine(ns[0]);
        else Console.Write("2");
    }

}


using System;

class program
{
    int g(long c)
    {
        if(c==0)
            return 0;
        else
            return 1;
    }
    static void Main()
    {
        var inp =Console.ReadLine().Split(' ');
        long l =Convert.ToInt64(inp[0]);
        long r =Convert.ToInt64(inp[1]);
        if(l==r)
        {
            Console.Write(l);
            return;
        }
        Console.Write(r/2 - l/2 - g(l%2));
    }
}


class Program
    {
        static void Main(string[] args)
        {
            int numberOfChars = Convert.ToInt32(Console.ReadLine());
            string inputString = Console.ReadLine();
            int toRemove = 0;

            Console.WriteLine(inputString);
            for(int i = 0; i < inputString.Length-2; i++)
            {
                string currentString = inputString.Substring(i, 3);
                Console.WriteLine(currentString);
                if(currentString.Contains("xxx"))
                {
                    toRemove++;
                }
            }
            Console.WriteLine(toRemove);
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace File_Name
{
    class Program
    {
        static void Main(string[] args)
        {
            string s= Console.ReadLine();
            string str = Console.ReadLine();
            string sub_str = "xxx";
            int count = 0;
            while(str.IndexOf(sub_str) is int i)
            {
                if(i<0)
                {
                    break;
                }
                str=str.Remove(i, 1);
                count++;
            }
            Console.WriteLine(count);
            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces12
{
    class Program
    {
        static void Main(string[] args)
        {
            int nameLength = Convert.ToInt32(Console.ReadLine());
            string fileName = Console.ReadLine();
            ColichestvoX(fileName);
        }
        public void ColichestvoX(string fileName)
        {
            //количество стоящих подряд символов х
            int x = 0;
            //количесвто символов для удаления
            int count = 0;

            for (int i = 0; i < fileName.Length; i++)
            {
                if (fileName[i] == 'x')
                {
                    x++;
                }
                else
                {
                    x = 0;
                }

                if(x > 2)
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }

    }
}


    string n = Console.ReadLine();
            string mas = Console.ReadLine();
            List<char> array = mas.ToCharArray().ToList();
            int x = 0;
            for (int i = 0; i < array.Count-2; i++)
            {
                if ((array[i] == array[i+1])&(array[i] == array[i+2])&(array[i]=='x'))
                {
                    x += 1;
                }
            }
            Console.Write(x);


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace File_Name
{
    class Program
    {
        static void Main(string[] args)
        {

            int len = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            string sub_str = "xxx";
            int count = 0;
            while(str.IndexOf(sub_str) is int i)
            {
                if(i<0)
                {
                    break;
                }
                str=str.Remove(i, 1);
                count++;
            }
            Console.WriteLine(count);
            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _LuckySum
{
    class ProgramLuckySum
    {
        static bool IsLucky(ulong n)
        {
            if (n == 0) return false;

            var num = n;
            while (num > 0)
            {
                var digit = num - (num / 10) * 10;
                if (digit != 4 && digit != 7) return false;
                num /= 10;
            }

            return true;
        }

        static void Main(string[] args)
        {
            var luckyNumbers = new List<ulong>();
            for (var n = 1UL; n <= 1000UL; n++)
            {
                if (IsLucky(n)) luckyNumbers.Add(n);
            }

            var input = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(input)) return;
            var lr = input.Split(' ');
            var l = ulong.Parse(lr[0]);
            var r = ulong.Parse(lr[1]);

            var i = 0;
            while (luckyNumbers[i] < l)
            {
                i++;
            }
            var sum = 0UL;
            var current = l;
            while (current <= r)
            {
                while (current <= luckyNumbers[i] && current <= r)
                {
                    sum += luckyNumbers[i];
                    current++;
                }
                i++;
            }

            Console.WriteLine(sum);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;

namespace ConsoleApp9
{
    class Program
    {
        static Dictionary<int, int> d = new Dictionary<int, int>()
        {
            { 1, 1},
            {2, 3},
            {3, 6 },
            { 4, 10},
        };

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            for(int i = 0; i < n; i++)
            {
                var sum = 0;
                var l = Console.ReadLine();
                if(l[0] != '1')
                {
                    int k = int.Parse(l[0].ToString());
                    sum = (k - 1) * 10 + d[l.Length];
                }
                else
                {
                    sum = d[l.Length];
                }
                Console.WriteLine(sum);
            }
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boring Apartments", "Boring Apartments\Boring Apartments.csproj", "{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{69A789E0-B204-4CC1-A7FE-A091E45AD0F2}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {510506D6-1FE9-4D61-8675-322580D41B76}
	EndGlobalSection
EndGlobal