Array of integers is unimodal, if:  it is strictly increasing in the beginning;  after that it is constant;  after that it is strictly decreasing. The first block (increasing) and the last block (decreasing) may be absent. It is allowed that both of this blocks are absent.For example, the following three arrays are unimodal: [5, 7, 11, 11, 2, 1], [4, 4, 2], [7], but the following three are not unimodal: [5, 5, 6, 6, 1], [1, 2, 1, 2], [4, 5, 5, 6].Write a program that checks if an array is unimodal.

The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 1 000) — the elements of the array.

Print "YES" if the given array is unimodal. Otherwise, print "NO". You can output each letter in any case (upper or lower).

NoteIn the first example the array is unimodal, because it is strictly increasing in the beginning (from position 1 to position 2, inclusively), that it is constant (from position 2 to position 4, inclusively) and then it is strictly decreasing (from position 4 to position 6, inclusively).

const
        nmax = 105;
var
        n,i,pos1,pos2 : integer;
        a : array[1..nmax] of integer;
BEGIN
        //assign(input,'input.inp');reset(input);
        //assign(output,'output.out');rewrite(output);
        readln(n);
        for i:=1 to n do read(a[i]);
        pos1:= 1;
        while (pos1 < n) and (a[pos1 + 1] > a[pos1]) do
                inc(pos1);
        pos2:= n;
        while (pos2 > 0) and (a[pos2 - 1] > a[pos2]) do
                dec(pos2);
        for i:=pos1 + 1 to pos2 do
                if a[i] <> a[i-1] then
                        begin
                                write('NO');
                                halt;
                        end;
        write('YES');
END.

const
    fi='';
    fo='';
    maxn=100;
var n:longint;
    a:array[1..maxn]of longint;
procedure input;
var f:text;
    i:longint;
begin
    assign(f,fi);
    reset(f);
    readln(f,n);
    for i:=1 to n do read(f,a[i]);
    close(f);
end;
function ans:boolean;
var base,i:longint;
begin
    base:=-1;
    for i:=2 to n do
    begin
        if(base=1)and(a[i]>=a[i-1])then exit(false);
        if(base=0)then
        begin
            if(a[i]>a[i-1])then exit(false);
            if(a[i]<a[i-1])then base:=1;
        end;
        if(base=-1)then
        begin
            if(a[i]<a[i-1])then base:=1;
            if(a[i]=a[i-1])then base:=0;
        end;
    end;
    exit(true);
end;
procedure output;
var f:text;
begin
    assign(f,fo);
    rewrite(f);
    if(ans)then write(f,'YES') else write(f,'NO');
    close(f);
end;
begin
    input;
    output;
end.

var n,i,tang,giam,hue:longint;
    a:array [1..1000] of longint;
begin
 readln(n);
 for i:=1 to n do
   read(a[i]);
 tang:=0; hue:=0; giam:=0;
 i:=2;
 while (a[i]>a[i-1]) and (i<=n) do
  begin
   tang:=i;
   inc(i);
  end;
  while (a[i]=a[i-1]) and (i<=n) do
   begin
    hue:=i;
    inc(i);
   end;
  if hue=0 then begin hue:=tang; dec(tang); end;
  while (a[i]<a[i-1]) and (i<=n) do
   begin
    giam:=i;
    inc(i);
   end;
  if i<=n then begin writeln('No'); halt; end;
   if (tang=0) or (giam=0) then writeln('Yes')
   else if (tang<hue) and (hue<giam) then writeln('Yes')
   else writeln('No');
end.

var
  n,k,i:integer;
  a:array[1..101] of integer;
begin
  readln(n);
  for i:=1 to n do read(a[i]);
  for i:=1 to n-1 do
   begin
    if a[i]<a[i+1] then a[i]:=1 else
    if a[i]=a[i+1] then a[i]:=2 else
    if a[i]>a[i+1] then a[i]:=3;
   end;
 for i:=1 to n-2 do
  if a[i]>a[i+1] then begin write('NO');exit;end;
 write('YES');
end.

const fi='';
    fo='';
var f:Text;
    a:array[1..101] of integer;
    n:byte;
procedure NHap;
var i:byte;
begin
    assign(f,fi);reset(F);
    read(f,n);
    for i:=1 to n do read(f,a[i]);
    close(F);
end;

procedure process;
var  i:byte;
begin
    assign(f,fo);rewrite(F);
    i:=1;
    while a[i]<a[i+1] do inc(i);
    while a[i]=a[i+1] do inc(i);
    while a[i]>a[i+1] do inc(i);
    if (i=n+1) then writeln(f,'YES') else writeln(f,'NO');
    close(F);
end;

begin
    NHap;
    process;
end.

var x,n,i,l:longint;
var r11,r21,r31,r32:boolean;
begin
  read(n);l:=0;
  for i:=1 to n do
  begin
    read(x);
    //if r1 and (x>l) then begin writeln('NO');exit;end;
    //if r2 and ((x=l) or (xthen begin writeln('NO');exit;end;
    //if not r1 and (x<l) then begin writeln('NO');exit;end;
    //if x<l then r2:=true;
    if (x>l) and not r11 then r11:=true
    else if (x>l) and r21 then begin writeln('NO');exit;end;
    if (x=l) and r11 and not r21 then begin r21:=true;end
    else if (x=l) and r31 then begin writeln('NO');exit;end;
    if (x<l) and not r31 then begin r21:=true;r31:=true;end;
    l:=x;
  end;
  writeln('YES');
end.

var
  n,now,i:longint;
  a:array[0..1000]of longint;
begin
  read(n);
  read(a[1]);
  now:=1;
  for i:=2 to n do
    begin
      read(a[i]);
      if a[i]<a[i-1] then now:=3
      else if a[i]=a[i-1] then
        begin
          if now=3 then
            begin
              write('NO');
              halt;
            end
          else now:=2;
        end
      else begin
             if now>1 then
             begin
               write('NO');
               halt;
             end
           end;
    end;
  write('YES');
end.

Uses math;
Var i,n,maxv,d,c,d1,d2:longint;
    kt:string;
    a:array[0..100+10] of longint;

BEGIN
        Read(n);
        For i:=1 to n do
                BEGIN
                 Read(a[i]);
                 maxv:=max(maxv,a[i]);
                END;
        //kt:='YES';
        For i:=1 to n do
         If a[i]=maxv then begin d:=i; break; end;
        For i:=n downto 1 do
         If a[i]=maxv then
                BEGIN
                 c:=i; break;
                END;
        For i:=d to c-1 do
         If a[i]<>a[i+1] then begin writeln('NO'); halt; end;
        d1:=1; d2:=1;
        For i:=2 to d do
         If a[i]>a[i-1] then inc(d1);
        For i:=n-1 downto c do
         If a[i]>a[i+1] then inc(d2);
        If (d1+d2+c-d-1=n) then writeln('YES') else writeln('NO');
END.

program yan;
  var ar:array[1..1000]of integer;
      i,j,x,y,a,b,n,m:longint;
begin
  readln(n);
  for i:=1 to n do
    read(ar[i]);
  for i:=1 to n-1 do
    begin
      if (ar[i]<ar[i+1])and(y=0)and(b=0) then continue
      else
      if (ar[i]=ar[i+1])and(y=0) then b:=1
      else
      if (ar[i]>ar[i+1]) then y:=1
      else begin write('NO'); exit; end;
    end;
  write('YES');
end.

const
  fi='';
  fo='';
var
  a:array[1..100] of longint;
  k,i,j,n:longint;
  ans:string;

begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);
  readln(n);
  for i:=1 to n do read(a[i]);
  ans:='YES';
  i:=1;
  j:=n;
  while (i<n) and (a[i]<a[i+1]) do inc(i);
  while (j>1) and (a[j]<a[j-1]) do dec(j);
  for k:=i to j do
    if a[k]<>a[i] then
      begin
        ans:='NO';
        break;
      end;
  write(ans);
  close(input);
  close(output);
end.

var
  k,i,a,t,t1,t2,t3,errors:integer;
begin
  readln(k);
  read(t);
  for i:=2 to k do
    begin
      read(a);
      if (t<a)and(t2=0)and(t3=0)
        then
          inc(t1)
        else
          if (t=a)and(t3=0)
            then
              inc(t2)
            else
              if (a<t)
                then
                  inc(t3)
                else
                  inc(errors);
      t:=a;
    end;
  if (errors > 0)
    then
      writeln('NO')
    else
      writeln('YES');
end.

var
        a:array[1..100]of integer;
        n,i,step,b:integer;
begin
readln(n);
for i:=1 to n do
        read(a[i]);
i:=2;
b:=a[1];
while (a[i]>b) and (i<=n) do
        begin
        b:=a[i];
        inc(i);
        end;
while (a[i]=b) and (i<=n) do
        begin
        b:=a[i];
        inc(i);
        end;
while (a[i]<b) and (i<=n) do
        begin
        b:=a[i];
        inc(i);
        end;
if i=n+1 then writeln('YES') else writeln('NO');
end.

var n,i:longint;
    x,y,z:boolean;
    a:array[1..100] of longint;

procedure xuat;
   begin
   write('NO');
   halt;
   end;

procedure xuli3(i:longint);
   var j:longint;
   begin
   for j:=i to n-1 do
      IF a[j+1]>=a[j] then xuat;
   write('YES');
   halt;
   end;

procedure xuli2(i:longint);
   var j:longint;
   begin
   for j:=i to n-1 do
      IF (a[j+1]>a[j]) then xuat
      else
         IF (a[j+1]<a[j]) and (z=true) then
            begin
            xuli3(j);
            z:=false;
            end
         else
            IF z=false then xuat;
   write('YES');
   halt;
   end;

procedure xuli1(i:longint);
   var j:longint;
   begin
   for j:=i to n-1 do
      IF (a[j+1]<a[j]) and (x=true) then
         begin
         xuli3(j);
         x:=false;
         end
      else
         IF x=false then xuat
         else
            IF (a[j+1]=a[j]) and (y=true) then
               begin
               xuli2(j);
               y:=false;
               end
            else
               IF x=false then xuat;
   write('YES');
   halt;
   end;

begin
readln(n);
x:=true;
y:=true;
z:=true;
for i:=1 to n do read(a[i]);
xuli1(1);
end.

Var a:array[1..100] of longint;
n,i,k,j,f:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
if a[1]<a[2] then k:=1;
if a[1]=a[2] then k:=2;
if a[1]>a[2] then k:=4;
if n=1 then k:=0;
                  i:=3;
if k=1 then for i:=3 to n do begin
                 if a[i]=a[i-1] then begin
                                       k:=2;
                                       f:=i;
                                       break;
                                     end;
                if a[i]<a[i-1] then begin
                                      k:=4;
                                      f:=i;
                                      break;
                                    end;
                                    end;
if f=0 then f:=3;
if k=2 then for j:=f to n do begin
                      if (a[j]>a[j-1]) then begin
                                              write('NO');
                                              k:=3;
                                              break;
                                            end;
                      if (a[j]<a[j-1]) then begin
                                              k:=4;
                                              f:=j;
                                              break;
                                            end;
                                            end;
if f=0 then f:=3;
if k=4 then for i:=f to n do
                       if (a[i]>=a[i-1]) then begin
                                                 write('NO');
                                                 k:=3;
                                                 break;
                                               end;
                                               if k<>3 then write('YES');
                                               end.

var
n,u,i,o:longint;
a:array[1..101]of longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
i:=2; if n=1 then begin
write('YES'); halt; end;
if a[n]=a[n-1] then a[n+1]:=a[n];
if a[n]<a[n-1] then a[n]:=a[n]-1;
while (a[i-1]<a[i]) and (i<n+1) do inc(i);
while (a[i-1]=a[i]) and (i<n+1) do inc(i);
while (a[i]<a[i-1]) and (i<n+1) do inc(i);
if i<n+1 then write('NO') else
write('YES'); end.

var n,i,l,m,k,z,q,j:integer;
a: array [1..1000] of integer;
begin
        readln (n);
        for i:=1 to n do
        read(a[i]);
        for j:=1 to n-1 do
        if a[j]<>a[j+1] then q:=q+1;
        if q=0 then writeln ('Yes')else
        begin
                l:=1;
                while (a[l]<>a[l+1]) and (a[l]<a[l+1]) do
                l:=l+1;
                m:=l;
                z:=l;
                k:=0;
                        while (k=0) and (m<>1) do
                        begin
                                if a[m]>a[m-1]then
                                m:=m-1 else
                                k:=1;
                        end;
                        if k<>0 then writeln('NO') else
                        begin
                                while a[z]=a[z+1] do
                                z:=z+1;

                                while (z<>n) and (k=0) do
                                begin
                                        if a[z]>a[z+1]
                                        then z:=z+1 else k:=1;
                                end;
                                if k<>0 then writeln('NO') else
                                writeln('Yes');
                          end;
          end;
end.

var
   n,i,flag:longint;
   a:array[1..1000] of longint;
begin
   readln (n);
   for i:=1 to n do read(a[i]);
   flag:=1;
   i:=1;
   while (i<n)and(a[i]<a[i+1]) do
      inc(i);
   while (i<n)and(a[i]=a[i+1]) do
   begin
      inc(i);
      flag:=2;
   end;
   while (i<n) and(a[i]>a[i+1]) do
      inc(i);
   if (i=n)     then writeln ('YES') else writeln ('NO');
end.

var n,i,tang,giam,hue:longint;
    a:array [1..1000] of longint;
begin
 readln(n);
 for i:=1 to n do
   read(a[i]);
 tang:=0; hue:=0; giam:=0;
 i:=2;
 while (a[i]>a[i-1]) and (i<=n) do
  begin
   tang:=i;
   inc(i);
  end;
  while (a[i]=a[i-1]) and (i<=n) do
   begin
    hue:=i;
    inc(i);
   end;
  if hue=0 then begin hue:=tang; dec(tang); end;
  while (a[i]<a[i-1]) and (i<=n) do
   begin
    giam:=i;
    i:=i+1;
   end;
  if i<=n then begin writeln('No'); halt; end;
   if (tang=0) or (giam=0) then writeln('Yes')
   else if (tang<hue) and (hue<giam) then writeln('Yes')
   else writeln('No');
end.

var i,n: integer;
    incr, cons, decr, ok: boolean;
    arr: array [1..1000] of integer;
begin
    readln (n);
    incr := false; decr := false; cons := false; ok := true;
    for i:=1 to n do read(arr[i]);
    for i:=2 to n do begin
        if (not incr) and (arr[i-1] >= arr[i]) then incr := true;
        if (not incr) and (arr[i-1] > arr[i]) then ok := false;
        if (incr) and (not cons) and (arr[i-1] > arr[i]) then cons := true;
        if (incr) and (not cons) and (arr[i-1] < arr[i]) then ok := false;
        if (incr) and (cons) and (arr[i-1] <= arr[i]) then ok := false;
    end;
    if (ok) then write ('YES') else write ('NO');
    //readln (n);
end.

const
  maxn = 100;
var
  check: boolean;
  n, i: shortint;
  a: array [1..maxn] of integer;

begin
  {assign(input,  'a.inp');
  reset(input);
  assign(output, 'a.out');
  rewrite(output);}

  readln(n);
  for i := 1 to n do read(a[i]);
  i := 1;
  while (a[i] < a[i+1]) and (i < n) do inc(i);
  while (a[i] = a[i+1]) and (i < n) do inc(i);
  while (a[i] > a[i+1]) and (i < n) do inc(i);
  if i = n then writeln('YES') else writeln('NO');

  {close(input);
  close(output);}
end.

var     a:array[0..200] of integer;
        i,j,z,max,vt1,vt2,n:integer;
begin
        readln(n);
        for i:=1 to n do read(a[i]);

        max:=a[1];  vt1:=1;
        for i:=2 to n do if a[i]>max then begin max:=a[i]; vt1:=i; end;
        for i:= vt1 to n do if a[i]=max then vt2:=i;
        i:=vt2;
        while (i<n) and (a[i+1]<a[i]) do inc(i);
        j:=vt1;
        while (j>1) and (a[j-1]<a[j]) do dec(j);
        z:=vt1;
        while (z<n) and (a[z+1]=a[z]) do inc(z);
        if (i=n) and  (j=1) and (z=vt2) then writeln('yes') else writeln('no');
end.

var
n,k,i:integer;
a:array[1..101] of integer;
begin
readln(n);
for i:=1 to n do
    read(a[i]);
k:=0;

for i:=1 to n-1 do begin
    if a[i]<a[i+1] then a[i]:=1
    else
        if a[i]=a[i+1] then a[i]:=2
        else
            if a[i]>a[i+1] then a[i]:=3;
end;

 for i:=1 to n-2 do begin
    if a[i]>a[i+1] then begin
        write('NO');
        exit;
    end;
 end;

write('YES');
end.

type mas = array[1..100] of integer;
var n,i:byte;
	a:mas;
BEGIN
	read(n);
	for i:=1 to n do
		read(a[i]);

	i:=1;
	while (a[i]<a[i+1]) and (i<n) do
	begin
		inc(i);
	end;

	if i=n then
	begin
		writeln('YES');
		exit;
	end;
	if a[i]<a[i+1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);

	while (a[i]=a[i-1]) and (i<n) do
	begin
		inc(i);

	end;

	if i=n+1 then
	begin
		writeln('YES');
		exit;
	end;

	if a[i]>a[i-1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);
	while (a[i]<a[i-1]) and (i<n) do
	begin
		inc(i);
	end;

	if a[i]>=a[i-1] then
	begin
		writeln('NO');
		exit;
	end;
	writeln('YES');
END.

var
n,i:longint;
a:array[-10..10000]of longint;
bol:boolean;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do begin
    if a[i]<a[i+1] then a[i]:=1
    else
    if a[i]=a[i+1] then a[i]:=2
    else
    if a[i]>a[i+1] then a[i]:=3;
end;
for i:=1 to n-2 do if a[i]>a[i+1] then bol:=true;
if bol then writeln('NO')
else
writeln('YES');
end.

var n:longint;
    i:longint;
    x,y:longint;
    a:array[0..110]of longint;
begin
  read(n);
  //x:=false;
  for i:=1 to n do
  read(a[i]);
  for i:=1 to n do
  if a[i]>a[i-1] then x:=i;
  for i:=1 to n do
  if a[i]>a[i+1] then
  begin
    y:=i;
    break;
  end;
  if x>y then
  begin
    writeln('NO');
    exit;
  end else
  begin
    for i:=1 to x-1 do
    if a[i]>=a[i+1] then
    begin
      writeln('NO');
      exit;
    end;
    for i:=y+1 to n do
    if a[i]>=a[i-1] then
    begin
      writeln('NO');
      exit;
    end;
    writeln('YES');
  end;
end.

const   fi='';
var
        a:array[1..100] of int32;
        n:int32;

procedure solve;
var i,l,r:int32; ok:boolean;
begin
        assign(input,fi); reset(input);
        readln(n);
        for i:=1 to n do read(a[i]);
        ok:= true;
        l:= 1;
        while (l<n) and (a[l]<a[l+1]) do inc(l);
        r:= n;
        while (r>1) and (a[r]<a[r-1]) do dec(r);
        if r>l then
        begin
                if a[l]>a[l+1] then ok:= false;
                if a[r]>a[r-1] then ok:= false;
        end;
        if r-l>0 then
        for i:= l to r-1 do if a[i]<>a[i+1] then ok:= false;
        if ok then write('YES') else write('NO');
end;
begin
        solve;
end.

var a:array[0..101]of longint;
       n,i,max,l,r,f:longint;
begin
	readln(n);
	for i:=1 to n do read(a[i]);
	if n=1 then begin
		writeln('YES');
		exit;
	end;
	if n=2 then begin
	writeln('YES');
	exit;
	end;
    max:=a[1];
    for i:=2 to n do if a[i]>max then max:=a[i];
    l:=0;
    for i:=1 to n do if a[i]=max then begin
    	l:=i;
    	break;
    end;
    r:=n+1;
    for i:=n downto 1 do if a[i]=max then begin
    	r:=i;
    	break;
    end;
    f:=0;
    a[0]:=a[1]-1;
    if l<>r then for i:=l to r-1 do if a[i]<>a[i+1]then f:=1;
    for i:=0 to l-1 do if a[i]>=a[i+1] then begin
    	f:=1;
    	break;
    end;
    a[n+1]:=a[n]-1;
    for i:=n+1 downto r+1 do if a[i]>=a[i-1]then f:=1;
    if f=1 then writeln('NO')
    else writeln('YES');
end.

var n,i:longint;A:array[0..100] of longint;
procedure       mo;
begin
        assign(input,'test.inp');reset(input);
        assign(output,'test.out');rewrite(output);
end;
procedure       dong;
begin
        close(input);close(output);
end;
procedure       nhap;
begin
        readln(n);
        if (n=1) then
                begin
                writeln('YES');
                halt;
                end;
        for i:=1 to n do
                read(A[i]);
end;
procedure       xuli;
var kt:longint;
begin
        kt:=1;
        if A[1]>A[2] then kt:=3;
        if A[1]<A[2] then kt:=1
        else if A[1]=A[2] then kt:=2;
        for i:=3 to n do
                begin
                if (kt=2) and (A[i]>A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end
                else if (kt=2) and (A[i]<A[i-1]) then kt:=3
                else if (kt=1) and (A[i]=A[i-1]) then kt:=2
                else if (kt=1) and (A[i]<A[i-1]) then kt:=3

                else if (kt=3) and (A[i]=A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end
                else if (kt=3) and (A[i]>A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end;
                end;
        writeln('YES');
end;
begin
   //     mo;
        nhap;
        xuli;
     //   dong;
end.

{$mode objfpc}

var
  n:integer;
  o,last,i :integer;
  kind:integer;

procedure axx;
  begin
    write('NO'); halt;
  end;

begin
  read(n);
  for i:=1 to n do
    begin
      read(o);
      if kind = 0 then
        begin
          if last = o then kind:=1;
          if last > o then kind:=2;
        end
      else
      if kind = 1 then
        begin
          if last < o then axx;
          if last > o then kind:=2;
        end
      else
      if kind = 2 then
        begin
          if last < o then axx;
          if last = o then axx;
        end;
      last:=o;
    end;
  write('YES');
end.

var
n,k,i:integer;
a:array[1..101] of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
k:=0;

for i:=1 to n-1 do begin
if a[i]<a[i+1] then a[i]:=1 else
if a[i]=a[i+1] then a[i]:=2 else
if a[i]>a[i+1] then a[i]:=3;
end;

 for i:=1 to n-2 do begin
 if a[i]>a[i+1] then begin write('NO');exit;end;
 end;

write('YES');
end.

var
	n, i, k, s: byte;
	a: array[1..100] of integer;
begin
	readln(n);
	for i:=1 to n do read(a[i]);
	k:=1;
	for i:=1 to n do
		if a[i+1] > a[i] then
			k:=i + 1
		else
			break;
	s:=n;
	for i:=n downto 1 do
		if a[i - 1] > a[i] then
			s:=i - 1
		else
			break;
	for i:=k to s - 1 do
		if a[i] <> a[i + 1] then
			begin
				write('NO');
				exit;
			end;
	writeln('YES');
end.

const
fin='unimodal.inp';
fon='unimodal.out';
var
a:array[1..100] of longint;
i,j,n:longint;
t,b,g,kt:boolean;
begin
{assign(input,fin);reset(input);
assign(output,fon);rewrite(output);}
readln(n);t:=true;
b:=false;
g:=false;kt:=true;
for i:=1 to n do read(a[i]);
for i:=2 to n do
   begin
   if t=true then
      begin
      {if a[i]<a[i-1] then
         begin
         kt:=false;
         break;
         end;  }
      if a[i]<=a[i-1] then
         begin
         t:=false;
         b:=true;
         g:=false;
         end;
      end;
   if b=true then
      begin
      if a[i]>a[i-1] then
         begin
         kt:=false;
         break;
         end;
      if a[i]<a[i-1] then
         begin
         b:=false;
         g:=true;
         t:=false;
         end;
      end;
   if g=true then
      begin
      if a[i]>=a[i-1] then
         begin
         kt:=false;
         break;
         end;
      end;
   end;
if kt=true then write('YES')
else write('NO');
{close(input);close(output);}
end.

var n,i,m:longint;
    a:array [1..1000] of longint;
begin
   readln(n);
   for i:=1 to n do read(a[i]);
   m:=0;
   for i:=1 to n do
   begin
      if m=0 then
      begin
         if a[i]>a[i+1] then m:=2;
         if a[i]=a[i+1] then m:=1;
      end;
      if m=1 then
      begin
         if a[i]<a[i+1] then
         begin
            writeln('NO');
            exit;
         end
         else
            if a[i]>a[i+1] then m:=2;
      end;
      if m=2 then
      begin
         if a[i]<=a[i+1] then
         begin
            writeln('NO');
            exit;
         end;
      end;
   end;
   writeln('YES');
end.

var	i,j,n:longint;
	a:array[0..105] of longint;

begin
	readln(n);
	fillchar(a,sizeof(a),0);
	for i:=1 to n do
		read(a[i]);
	i:=2;
	if a[i]>a[i-1] then
	begin
		while (i<=n) and (a[i]>a[i-1]) do inc(i);
	end;
	if a[i]=a[i-1] then
	begin
		while (i<=n) and (a[i]=a[i-1]) do inc(i);
	end;
	if a[i]<a[i-1] then
	begin
		while (i<=n) and (a[i]<a[i-1]) do inc(i);
	end;
	if i>n then writeln('YES') else writeln('NO');
end.

const   fi='test.inp';
        fo='test.out';
var     a:array[0..1000] of longint;
        n:longint;
        kq:string;
procedure Nhap;
var     i:longint;
begin
        //assign(input,fi);
        //reset(input);
        readln(n);
        for i:=1 to n do
                read(a[i]);
        //close(input);
end;

procedure Main;
var     i:longint;
begin
        kq:='NO';             i:=1;           a[0]:=-1;

        while a[i-1]<a[i] do inc(i);
        while a[i-1]=a[i] do inc(i);
        while a[i-1]>a[i] do inc(i);

        if i>=n+1 then kq:='YES';
end;
procedure Xuat;
begin
        //assign(output,fo);
        //rewrite(output);
        write(kq);
        //close(output);
end;
begin
        Nhap;
        main;
        Xuat;
end.

const fi='';
      fo='';
var a:array[1..101] of integer;
    n:integer;

procedure docf;
var f:text; i:integer;
begin
  assign(f,fi); reset(f);
  readln(f,n);
  for i:=1 to n do
   read(f,a[i]);
  close(f);
end;

procedure solve;
var f:Text; i:integer;
begin
  assign(f,fo); rewrite(f);
  i:=2;
  while (i<=n) and (a[i-1]<a[i]) do inc(i);
  while (i<=n) and (a[i-1]=a[i]) do inc(i);
  while (i<=n) and (a[i-1]>a[i]) do inc(i);
  if (i<=n) then writeln(f,'NO') else writeln(f,'YES');
  close(f);
end;

begin
  docf;
  solve;
end.

   const nn=1600000; nnn=200000;eps=0.0000000001;
   label 1,2;
    type    real=extended;  {string=ansistring;}
    int64=longint;
    mas=array [0..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of int64;mass1=^mass;
    var qq,p3,start,modul,pp,ot,q,ll,rr,aa,bb,cc,p1,p2,l,r,pos,t,kolx,kolo,nm,n,k,s1,s2,m,s,imax,smin,cen,dl,t2,i1,p,besk:int64;
    tt,ii,jj,step, i,j:longint;
     time:real;
     pole:array[-10..200,-10..200] of char;
     ssot,sssnew:array[-10..3000000] of char;
     smas:array[-10..2000000]of string;
     skobk,zz,z,sum,c,d,x,y,a,b:array[-1000002..6000000] of int64;
     per,dda,ddb:array[-10..120,-10..120] of int64;
     ss3,ss1,ss2:string;
    ss:string;ch:char;
    maxpr:array[0..nn] of string;
    st2:array[0..nnn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     xx,yy:array[-1..nn] of double;
     yot:double;
     prost:array [-1000..6000000] of boolean;
       flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;

    end;
    d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt;
   evkl:=tt1;
end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k div 2); degg:=p*p mod modul;   end;

end;

function good(ii,jj:longint):boolean;
var i,j:longint; flag:boolean;
begin
   flag:=true;
   for i:=2 to ii do if a[i]<=a[i-1] then flag:=false;
   for i:=jj+1 to n do if a[i]>=a[i-1] then flag:=false;
   for i:=ii+1 to jj do if a[i]<>a[i-1] then flag:=false;

   good:=flag;
end;

begin
  {  assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
   }
     read(n); for i:=1 to n do read(a[i]);
     for ii:=1 to n do for jj:=ii to n do
    begin
     if good(ii,jj) then flag:=true;
   {  writeln(ii,' ',jj,' ',good(ii,jj));
  }  end;
     if flag then write('YES') else write('NO');

   1:          close(output);
end.

const
        nmax = 105;
var
        n,i,pos1,pos2 : integer;
        a : array[1..nmax] of integer;
BEGIN
        //assign(input,'input.inp');reset(input);
        //assign(output,'output.out');rewrite(output);
        readln(n);
        for i:=1 to n do read(a[i]);
        pos1:= 1;
        while (pos1 < n) and (a[pos1 + 1] > a[pos1]) do
                inc(pos1);
        pos2:= n;
        while (pos2 > 0) and (a[pos2 - 1] > a[pos2]) do
                dec(pos2);
        for i:=pos1 + 1 to pos2 - 1 do
                if a[i] <> a[i+1] then
                        begin
                                write('NO');
                                halt;
                        end;
        write('YES');
END.

const
        nmax = 105;
var
        n,i,vt : integer;
        a : array[1..nmax] of integer;
BEGIN
        //assign(input,'input.inp');reset(input);
        //assign(output,'output.out');rewrite(output);
        readln(n);
        for i:=1 to n do read(a[i]);
        vt:= 0;
        for i:=1 to n-1 do
                if a[i+1] <= a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        for i:=vt + 1 to n-1 do
                if a[i+1] <> a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        while (vt < n) do
                begin
                        if a[vt + 1] > a[vt] then
                                begin
                                        write('NO');
                                        halt;
                                end;
                        inc(vt);
                end;
        write('YES');
END.

const
        nmax = 105;
var
        n,i,vt : integer;
        a : array[1..nmax] of integer;
BEGIN
        //assign(input,'input.inp');reset(input);
        //assign(output,'output.out');rewrite(output);
        readln(n);
        for i:=1 to n do read(a[i]);
        inc(n);
        a[n]:= 0;
        vt:= 0;
        for i:=1 to n-1 do
                if a[i+1] <= a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        for i:=vt + 1 to n-1 do
                if a[i+1] <> a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        while (vt < n) do
                begin
                        if a[vt + 1] >= a[vt] then
                                begin
                                        write('NO');
                                        halt;
                                end;
                        inc(vt);
                end;
        write('YES');
END.

const
        nmax = 105;
var
        n,i,vt : integer;
        a : array[1..nmax] of integer;
BEGIN
        //assign(input,'input.inp');reset(input);
        //assign(output,'output.out');rewrite(output);
        a[1]:= 0;
        readln(n);
        for i:=1 to n do readln(a[i+1]);
        a[n+2]:= 0;
        n:= n + 2;
        vt:= 0;
        for i:=1 to n-1 do
                if a[i+1] <= a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        for i:=vt + 1 to n-1 do
                if a[i+1] <> a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        while (vt < n) do
                begin
                        if a[vt + 1] >= a[vt] then
                                begin
                                        write('NO');
                                        halt;
                                end;
                        inc(vt);
                end;
        write('YES');
END.

const
        nmax = 105;
var
        n,i,vt : integer;
        a : array[1..nmax] of integer;
BEGIN
        //assign(input,'input.inp');reset(input);
        //assign(output,'output.out');rewrite(output);
        a[1]:= 0;
        readln(n);
        for i:=1 to n do read(a[i+1]);
        a[n+2]:= 0;
        n:= n + 2;
        vt:= 0;
        for i:=1 to n-1 do
                if a[i+1] <= a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        for i:=vt + 1 to n-1 do
                if a[i+1] <> a[i] then
                        begin
                                vt:= i;
                                break;
                        end;
        if vt = n then
                begin
                        write('YES');
                        halt;
                end;
        while (vt < n) do
                begin
                        if a[vt + 1] >= a[vt] then
                                begin
                                        write('NO');
                                        halt;
                                end;
                        inc(vt);
                end;
        write('YES');
END.

const
    fi='';
    fo='';
    maxn=100;
var n:longint;
    a:array[1..maxn]of longint;
procedure input;
var f:text;
    i:longint;
begin
    assign(f,fi);
    reset(f);
    readln(f,n);
    for i:=1 to n do read(f,a[i]);
    close(f);
end;
function ans:boolean;
var base,i:longint;
begin
    base:=-1;
    for i:=2 to n do
    begin
        if(base=1)and(a[i]>=a[i-1])then exit(false);
        if(base=0)then
        begin
            if(a[i]>a[i-1])then exit(false);
            if(a[i]<a[i-1])then base:=1;
        end;
        if(base=-1)then
        begin
            if(a[i]<a[i-1])then exit(false);
            if(a[i]=a[i-1])then base:=0;
        end;
    end;
    exit(true);
end;
procedure output;
var f:text;
begin
    assign(f,fo);
    rewrite(f);
    if(ans)then write(f,'YES') else write(f,'NO');
    close(f);
end;
begin
    input;
    output;
end.

var
 i,j,n,l,kol
 : longint;
 a : array[1..100] of longint;
 pr,sf : array[0..101] of boolean;
begin
 readln(n);
 for i:=1 to n do read(a[i]);
 pr[1]:=true;
 for i:=2 to n do if a[i]>a[i-1] then pr[i]:=true else  break;
 sf[n]:=true;
 for i:=n-1 downto 1 do if a[i]>a[i+1] then sf[i]:=true else break;
 i:=2;
 while (i<=n) do
  begin
   l:=i;
   j:=i+1;
   while (a[j]=a[i]) do inc(j); dec(j);
   i:=j;
   if (pr[l]) and (sf[i]) then begin writeln('YES'); halt; end;
   inc(i);
  end;
 kol:=0;
 for i:=2 to n do if a[i]<>a[i-1] then inc(kol);
 if kol=0 then writeln('YES') else
 writeln('NO');
end.

var
  n,i,now,j,t:longint;
  a:array[0..1000]of longint;
  bo,boo:boolean;
begin
  read(n);
  read(a[1]);
  bo:=false;
  boo:=false;
  for i:=2to n do
    begin
      read(a[i]);
      if a[i]<a[i-1] then
        begin
          if now=0 then now:=1;
          if now=2 then
             begin
               if bo then begin
               write('NO');
               halt;
               end
               else begin
                      bo:=true;
                      now:=1;
                    end;
             end;
        end
      else if a[i]>a[i-1] then
        begin
          if now=0 then now:=2;
          if now=1 then
             begin
               if bo then begin
               write('NO');
               halt;
               end
               else begin
                      bo:=true;
                      now:=2;
                    end;
             end
        end
      else begin
             if bo then begin
               write('NO');
               halt;
               end;
             if t=0 then t:=a[i]
             else if t<>a[i] then
               begin
                    write('NO');
                    halt;
                  end;
           end;
    end;
  write('YES');
end.

Uses math;
Var i,n,maxv,vt:longint;
    kt:string;
    a:array[0..100+10] of longint;

BEGIN
        Read(n);
        For i:=1 to n do read(a[i]);
        vt:=1; maxv:=a[1]; kt:='YES';
        For i:=2 to n do
         If a[i]>=maxv then
                BEGIN
                 vt:=i;
                 maxv:=a[i];
                END;
        For i:=2 to vt do
         If a[i]<a[i-1] then kt:='NO';
        For i:=vt+1 to n do
         If a[i]>a[i-1] then kt:='NO';
        Writeln(kt);
END.

const
  fi='';
  fo='';
var
  a:array[1..100] of longint;
  k,i,j,n:longint;
  ans:string;

begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);
  readln(n);
  for i:=1 to n do read(a[i]);
  ans:='YES';
  i:=1;
  j:=n;
  while (i<n) and (a[i]<a[i+1]) do inc(i);
  while (j>1) and (a[j-1]>a[j]) do dec(j);
  writeln(i);
  writeln(j);
  //if a[i]>a[i+1] then ans:='NO';
  //if a[j]>a[j-1] then ans:='NO';
  for k:=i to j do
    if a[k]<>a[i] then
      begin
        ans:='NO';
        break;
      end;
  write(ans);
  close(input);
  close(output);
end.

var n,i:longint;
    x,y,z:boolean;
    a:array[1..100] of longint;

procedure xuat;
   begin
   write('NO');
   halt;
   end;

procedure xuli3(i:longint);
   var j:longint;
   begin
   for j:=i to n-1 do
      IF a[j+1]>=a[j] then xuat;
   write('YES');
   halt;
   end;

procedure xuli2(i:longint);
   var j:longint;
   begin
   for j:=i to n-1 do
      IF (a[j+1]>a[j]) then xuat
      else
         IF (a[j+1]<a[j]) and (z=true) then
            begin
            xuli3(j);
            z:=false;
            end
         else
            IF z=false then xuat;
   write('YES');
   halt;
   end;

procedure xuli1(i:longint);
   var j:longint;
   begin
   for j:=i to n-1 do
      IF (a[j+1]<a[j]) and (x=true) then
         begin
         xuli3(j);
         x:=false;
         end
      else
         IF x=false then xuat
         else
            IF (a[j+1]=a[j]) and (y=true) then
               begin
               xuli2(j);
               y:=false;
               end
            else
               IF x=false then xuat;
   end;

begin
readln(n);
x:=true;
y:=true;
z:=true;
for i:=1 to n do read(a[i]);
xuli1(1);
end.

var n,i,l,m,k,z,q,j:integer;
a: array [1..1000] of integer;
begin
        readln (n);
        for i:=1 to n do
        read(a[i]);
        for j:=1 to n-1 do
        if a[j]<>a[j+1] then q:=q+1;
        if q=0 then writeln ('Yes')else
        begin
                l:=1;
                while (a[l]<>a[l+1]) and (a[l]<a[l+1])  do
                l:=l+1;
                m:=l;
                z:=l;
                k:=0;
                        while (k=0) and (m<>1) do
                        begin
                                if a[m]>a[m-1]then
                                m:=m-1 else
                                k:=1;
                        end;
                        if k<>0 then writeln('NO') else
                        begin
                                while (z<>n) and (k=0) do
                                begin
                                        if (a[z]>=a[z+1]) and (a[z]<=a[l])
                                        then z:=z+1 else k:=1;
                                end;
                                if k<>0 then writeln('NO') else
                                writeln('Yes');
                          end;
          end;
end.

var n,i,l,m,k,z,q,j:integer;
a: array [1..1000] of integer;
begin
        readln (n);
        for i:=1 to n do
        read(a[i]);
        for j:=1 to n-1 do
        if a[j]<>a[j+1] then q:=q+1;
        if q=0 then writeln ('Yes')else
        begin
                l:=1;
                while a[l]<>a[l+1] do
                l:=l+1;
                m:=l;
                z:=l;
                k:=0;
                        while (k=0) and (m<>1) do
                        begin
                                if a[m]>a[m-1]then
                                m:=m-1 else
                                k:=1;
                        end;
                        if k<>0 then writeln('NO') else
                        begin
                                while (z<>n) and (k=0) do
                                begin
                                        if (a[z]>=a[z+1]) and (a[z]<=a[l])
                                        then z:=z+1 else k:=1;
                                end;
                                if k<>0 then writeln('NO') else
                                writeln('Yes');
                          end;
          end;
end.

type mas = array[1..100] of integer;
var n,i:byte;
	a:mas;
BEGIN
	read(n);
	for i:=1 to n do
		read(a[i]);

	i:=1;
	while (a[i]<a[i+1]) and (i<n) do
	begin
		inc(i);
	end;

	if i=n then
	begin
		writeln('YES');
		exit;
	end;
	if a[i]<a[i+1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);

	while (a[i]=a[i-1]) and (i<n) do
	begin
		inc(i);

	end;

	if i=n then
	begin
		writeln('YES');
		exit;
	end;

	if a[i]>a[i-1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);
	while (a[i]<a[i-1]) and (i<n) do
	begin
		inc(i);
	end;

	if a[i]>=a[i-1] then
	begin
		writeln('NO');
		exit;
	end;
	writeln('YES');
END.

type mas = array[1..100] of integer;
var n,i:byte;
	a:mas;
BEGIN
	read(n);
	for i:=1 to n do
		read(a[i]);

	i:=1;
	while (a[i]<a[i+1]) and (i<n) do
	begin
		inc(i);
	end;

	if a[i]<a[i+1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);

	while (a[i]=a[i-1]) and (i<n) do
	begin
		inc(i);

	end;

	if i<n then inc(i);

	if a[i]>a[i-1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);
	while (a[i]<a[i-1]) and (i<n) do
	begin
		inc(i);
	end;

	if a[i]>=a[i-1] then
	begin
		writeln('NO');
		exit;
	end;
	writeln('YES');
END.

type mas = array[1..100] of integer;
var n,i:byte;
	a:mas;
BEGIN
	read(n);
	for i:=1 to n do
		read(a[i]);

	if n=1 then
	begin
		writeln('YES');
		exit;
	end;

	i:=1;
	while (a[i]<a[i+1]) and (i<n) do
	begin
		inc(i);
	end;

	if a[i]<a[i+1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);

	while (a[i]=a[i-1]) and (i<n) do
	begin
		inc(i);

	end;

	if i<n then inc(i);

	if a[i]>a[i-1] then
	begin
		writeln('NO');
		exit;
	end;

	inc(i);
	while (a[i]<a[i-1]) and (i<n) do
	begin
		inc(i);
	end;

	if a[i]>=a[i-1] then
	begin
		writeln('NO');
		exit;
	end;
	writeln('YES');
END.

var
n,i,ind:longint;
a:array[-1000..100000]of longint;
bol:boolean;
begin
readln(n);
for i:=1 to n do begin
    read(a[i]);
end;
for i:=2 to n do begin
    if a[i]<=a[i-1] then begin
        ind:=i-1;
        break;
    end;
end;

for i:=2 to ind do begin
    if a[i]<=a[i-1] then bol:=true;
end;
i:=ind;
while  i<=n-1 do begin
    if a[i]=a[i+1] then begin

    inc(i);
    ind:=i;
    end
    else begin
        ind:=i;
        inc(i);
        break;
    end;
end;          {
for i:=ind to n-1 do begin
    if a[i]<>a[i+1] then begin
        ind:=i;
        break;
    end;
end;           }
for i:=ind+1 to n do begin
    if a[i]>=a[i-1] then bol:=true;
end;
if bol then writeln('NO')
else
writeln('YES');
end.

var
bol,bol1:boolean;
n,i,ind:longint;
a:array[-100..1000]of longint;
begin
readln(N);

for i:=1 to n do read(A[i]);
if n=1 then writeln('YES')
else begin
for i:=2 to n do begin
    if a[i]<a[i-1] then ind:=i-1;
    if a[i]=a[i-1] then begin
        ind:=i-1;
        break;
    end;
end;
for i:=ind to n-1 do begin
    if a[i]<a[i+1] then bol:=true;
    if a[i]>a[i+1] then begin
        bol1:=true;

        ind:=i;
        break;
    end;
end;
//writeln(ind);
if bol1 then begin
    for i:=ind to n-1 do begin
        if a[i]<=a[i+1] then bol:=true;
    end;
end;
if bol then writeln('NO')
else
writeln('YES');
end;
end.

var n:longint;
    i:longint;
    x,y:longint;
    a:array[0..110]of longint;
begin
  read(n);
  //x:=false;
  for i:=1 to n do
  read(a[i]);
  for i:=1 to n do
  if a[i]>a[i-1] then x:=i;
  for i:=1 to n do
  if a[i]>a[i+1] then
  begin
    y:=i;
    break;
  end;
  if x>y then
  begin
    writeln('NO');
    exit;
  end else
  begin
    for i:=y+1 to n do
    if a[i]>=a[i-1] then
    begin
      writeln('NO');
      exit;
    end;
    writeln('YES');
  end;
end.

const   fi='';
var
        a:array[1..100] of int32;
        n:int32;

procedure solve;
var i,l,r:int32; ok:boolean;
begin
        //assign(input,fi); reset(input);
        readln(n);
        for i:=1 to n do read(a[i]);
        ok:= true;
        l:= 1;
        while (l<n) and (a[l]<a[l+1]) do inc(l);
        if a[l]>a[l+1] then ok:= false;
        r:= n;
        while (r>1) and (a[r]<a[r-1]) do dec(r);
        if a[r]>a[r-1] then ok:= false;
        if r-l>0 then
        for i:= l to r-1 do if a[i]<>a[i+1] then ok:= false;
        if ok then write('YES') else write('NO');
end;
begin
        solve;
end.

var n,i:longint;A:array[0..104] of longint;
procedure       mo;
begin
        assign(input,'test.inp');reset(input);
        assign(output,'test.out');rewrite(output);
end;
procedure       dong;
begin
        close(input);close(output);
end;
procedure       nhap;
begin
        readln(n);
        if (n=1) then
                begin
                writeln('YES');
                halt;
                end;
        for i:=1 to n do
                read(A[i]);
end;
procedure       xuli;
var kt:longint;
begin
        kt:=1;
        if A[1]>A[2] then
                begin
                writeln('NO');
                halt;
                end;
        if A[1]<A[2] then kt:=1
        else if A[1]=A[2] then kt:=2;
        for i:=3 to n do
                begin
                if (kt=2) and (A[i]>A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end
                else if (kt=2) and (A[i]<A[i-1]) then kt:=3
                else if (kt=1) and (A[i]=A[i-1]) then kt:=2
                else if (kt=1) and (A[i]<A[i-1]) then kt:=3

                else if (kt=3) and (A[i]=A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end
                else if (kt=3) and (A[i]>A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end;
                end;
        writeln('YES');
end;
begin
       // mo;
        nhap;
        xuli;
        //dong;
end.

var n,i:longint;A:array[0..100] of longint;
procedure       mo;
begin
        assign(input,'test.inp');reset(input);
        assign(output,'test.out');rewrite(output);
end;
procedure       dong;
begin
        close(input);close(output);
end;
procedure       nhap;
begin
        readln(n);
        if (n=1) then
                begin
                writeln('YES');
                halt;
                end;
        for i:=1 to n do
                read(A[i]);
end;
procedure       xuli;
var kt:longint;
begin
        kt:=1;
        if A[1]>A[2] then
                begin
                writeln('NO');
                halt;
                end;
        if A[1]<A[2] then kt:=1
        else if A[1]=A[2] then kt:=2;
        for i:=3 to n do
                begin
                if (kt=2) and (A[i]>A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end
                else if (kt=2) and (A[i]<A[i-1]) then kt:=3
                else if (kt=1) and (A[i]=A[i-1]) then kt:=2
                else if (kt=1) and (A[i]<A[i-1]) then kt:=3

                else if (kt=3) and (A[i]=A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end
                else if (kt=3) and (A[i]>A[i-1]) then
                        begin
                        writeln('NO');
                        halt;
                        end;
                end;
        writeln('YES');
end;
begin
       // mo;
        nhap;
        xuli;
        //dong;
end.

var
n,k,i:integer;
a:array[1..101] of integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
k:=0;

for i:=1 to n-1 do begin
if a[i]<a[i+1] then a[i]:=1;
if a[i]=a[i+1] then a[i]:=2;
if a[i]>a[i+1] then a[i]:=3;
end;

 for i:=1 to n-2 do begin
 if a[i]>a[i+1] then begin write('NO');exit;end;
 end;

write('YES');
end.

var n,i,m:longint;
    a:array [1..1000] of longint;
begin
   readln(n);
   for i:=1 to n do read(a[i]);
   m:=0;
   for i:=1 to n do
   begin
      if m=0 then
      begin
         if a[i]>a[i+1] then
         begin
            writeln('NO');
            exit;
         end
         else
            if a[i]=a[i+1] then m:=1;
      end;
      if m=1 then
      begin
         if a[i]<a[i+1] then
         begin
            writeln('NO');
            exit;
         end
         else
            if a[i]>a[i+1] then m:=2;
      end;
      if m=2 then
      begin
         if a[i]<=a[i+1] then
         begin
            writeln('NO');
            exit;
         end;
      end;
   end;
   writeln('YES');
end.

   const nn=1600000; nnn=200000;eps=0.0000000001;
   label 1,2;
    type    real=extended;  {string=ansistring;}
    int64=longint;
    mas=array [0..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of int64;mass1=^mass;
    var qq,p3,start,modul,pp,ot,q,ll,rr,aa,bb,cc,p1,p2,l,r,pos,t,kolx,kolo,nm,n,k,s1,s2,m,s,imax,smin,cen,dl,t2,i1,p,besk:int64;
    tt,ii,jj,step, i,j:longint;
     time:real;
     pole:array[-10..200,-10..200] of char;
     ssot,sssnew:array[-10..3000000] of char;
     smas:array[-10..2000000]of string;
     skobk,zz,z,sum,c,d,x,y,a,b:array[-1000002..6000000] of int64;
     per,dda,ddb:array[-10..120,-10..120] of int64;
     ss3,ss1,ss2:string;
    ss:string;ch:char;
    maxpr:array[0..nn] of string;
    st2:array[0..nnn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     xx,yy:array[-1..nn] of double;
     yot:double;
     prost:array [-1000..6000000] of boolean;
       flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;

    end;
    d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt;
   evkl:=tt1;
end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k div 2); degg:=p*p mod modul;   end;

end;

begin
   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
     read(n); for i:=1 to n do read(a[i]);
     flag:=true;
     for i:=2 to n-1 do if 2*a[i]<(a[i-1]+a[i+1]) then
     flag:=false;
     if flag then write('YES') else write('NO');

   1:          close(output);
end.


Professional sport is more than hard work. It also is the equipment, designed by top engineers. As an example, let's take tennis. Not only should you be in great shape, you also need an excellent racket! In this problem your task is to contribute to the development of tennis and to help to design a revolutionary new concept of a racket!The concept is a triangular racket. Ant it should be not just any triangle, but a regular one. As soon as you've chosen the shape, you need to stretch the net. By the time you came the rocket had n holes drilled on each of its sides. The holes divide each side into equal n + 1 parts. At that, the m closest to each apex holes on each side are made for better ventilation only and you cannot stretch the net through them. The next revolutionary idea as to stretch the net as obtuse triangles through the holes, so that for each triangle all apexes lay on different sides. Moreover, you need the net to be stretched along every possible obtuse triangle. That's where we need your help — help us to count the number of triangles the net is going to consist of.Two triangles are considered to be different if their pictures on the fixed at some position racket are different.

The first and the only input line contains two integers n, m .

Print a single number — the answer to the problem.

NoteFor the following picture n = 8, m = 2. White circles are the holes for ventilation, red circles — holes for net stretching. One of the possible obtuse triangles is painted red.

var n,m,t,i,j,k:longint;
  ans:int64;
  begin
    readln(n,m);
    t:=(n+1) div 2;
    for i:=m+1 to t do
      begin
        k:=n-m;
        for j:=m+1 to n-m do
          begin
            while (k>m)and(k*(i+j)+j*(n-i+1)>=2*(n-i+1)*i) do dec(k);
            if k=m then break;
            ans:=ans+k-m;
          end;
        if i=n div 2 then ans:=ans*2;
      end;
    write(ans*3);
  end.

{$A+,B-,D-,E-,F-,G+,I-,L-,N+,O-,P+,Q-,R-,S-,T-,V-,X+,Y-}
//uses math;
var
    ans:int64;
    i,j,up,n,m,x,y:longint;

function min(x,y:longint):longint;inline;
begin
    if x<y then exit(x) else exit(y);
end;

begin
    readln(n,m);
    up:=(n+1) div 2;
    for i:=m+1 to up do
        begin
            for j:=m+1 to n-m do
                begin
                    x:=(n+1-i)*(2*i-j);
                    y:=(x+i+j-1) div (i+j)-1;
                    if y<=m then break;
                    ans:=ans+min(y,n-m)-m;
                end;
            if i=n div 2 then ans:=ans shl 1;
        end;
    writeln(ans*3);
end.