Mahmoud has n line segments, the i-th of them has length ai. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn't accept challenges unless he is sure he can win, so he asked you to tell him if he should accept the challenge. Given the lengths of the line segments, check if he can choose exactly 3 of them to form a non-degenerate triangle.Mahmoud should use exactly 3 line segments, he can't concatenate two line segments or change any length. A non-degenerate triangle is a triangle with positive area.

The first line contains single integer n (3 ≤ n ≤ 105) — the number of line segments Mahmoud has. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the lengths of line segments Mahmoud has.

In the only line print "YES" if he can choose exactly three line segments and form a non-degenerate triangle with them, and "NO" otherwise.

NoteFor the first example, he can use line segments with lengths 2, 4 and 5 to form a non-degenerate triangle.

var a:array[-10..200000]of longint;
    n,i:longint;
procedure qsort(l,r:longint);
var m,q,i,j:longint;
begin
 i:=l;j:=r;
 m:=a[(i+j)div 2];
 while i<j do
  begin
   while a[i]<m do inc(i);
   while a[j]>m do dec(j);
   if i<=j
    then begin
          q:=a[i];
          a[i]:=a[j];
          a[j]:=q;
          inc(i);dec(j);

          end;
  end;
if i<r then qsort(i,r);
if l<j then qsort(l,j)

end;
begin
 read(n);
  for i:=1 to n do
  read(a[i]);

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

end.

var a:array[0..10000]of longint;i,j,n:longint;
PROCEDURE HV(VAR a,b:longint);
VAR   tmp:longint;
BEGIN
     tmp:=a;a:=b;b:=tmp;
END;

PROCEDURE QS(l,r:longint);
VAR   i,j,k:longint;
BEGIN
     i:=l;j:=r;k:=a[(l+r)div 2];
     REPEAT
           WHILE a[i]<k DO i:=i+1;
           WHILE a[j]>k DO j:=j-1;
           IF i<=j THEN
              BEGIN
                   HV(a[i],a[j]);
                   i:=i+1;j:=j-1;
              END;
     UNTIL i>j;
     IF i<r THEN QS(i,r);
     IF l<j THEN QS(l,j);
END;
begin
read(n);if n>50 then  write('YES') else begin
 for i:=1 to n do read(a[i]);
 qs(1,n);
 for i:=3 to n do if a[i]<a[i-1]+a[i-2] then begin write('YES');halt;end;
 write('NO');end;
 end.

               const
                    eps=1e-10;
                    besk=9223372036854775807;
                   { modul=1000000007; }

                     label 1,2,3,44;
                 type
                     mas=array[-200000..4*2*100000+1] of int64;
var
steppp,oldtt,mm,n,ii,jj,iii,k,i,j,step,stepp:longint;
razn,modul,p,ppp,n1,n2,zap,ot1,ot2,p1,p2,pp2,pp1,pos,kolpl,kolmin,kolzer,kkk,tt,l,dl,i1,j1,imin,pp,m,k1,w,mesto,pl1,pl2,pl3:int64;
ott,pos1,pos2,aa,bb,c3,t,mask,sum,t1,t2,cc,nn,ot,pmin,tmax,minf,kk,gr1,gr2,tt1,nnn,raz1,raz2,v,st,q,gr:int64; flag1:boolean;
 zan:array[0..1000000] of boolean;
 cha:char;
str,hh,place,s,kol,z1,next,prev,oldxx,oldleft,oldright,left,right,d,d1,time,xx,yy,z,b2,a2,b3,a3,fuc,fac,kolali,kolbob,b1,a1:array[-10000..1600000] of int64;
bbbb,cccc:array[0..100000] of extended;
znak:array[-10000..1000000] of char;
 ss,ss1:string;
f:array[0..225000,0..40] of int64;
t3:extended; ch:char;
x,y,stepen:array[0..2000000] of int64;
marked,zan1,zan2:array[-3000000..3000000] of boolean;

a,ll,rr,ccc, c,b:mas; flag:boolean;  pl:longint;
function srav(i,j:longint):boolean;
begin if   (a[i]<a[j])or(a[i]=a[j])and(a1[i]<a1[j])or(a[i]=a[j])and(a1[i]=a1[j])and(a2[i]<a2[j]) then srav:=true else srav:=false; end;

procedure sl (k,l,m:longint);  {k- dlina, l,m - nachalo dvuh blokov}
begin
i:=l;j:=m; flag:=true; step:=0;while flag do begin
if {((a[i])<(a[j]))}srav(i,j) then
begin begin b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];b3[l+step]:=a3[i]; end;
inc(step);inc(i);
{writeln('step=',step,' i=',i);} end;
if {((a[i])>=(a[j]))}not srav(i,j) then
begin begin b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];b3[l+step]:=a3[j];end;
inc(step);inc(j);end;
if  ((i>=l+k) or (j>=m+k)) then flag:=false;
end;
if(i>=l+k) then repeat b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];b3[l+step]:=a3[j]; inc(step);inc(j);until (j>=m+k);
if(j>=m+k) then repeat b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];b3[l+step]:=a3[i];inc(step);inc(i);until (i>=l+k);
end;
procedure sort(var c:mas);

begin

k:=1; repeat
l:=1;m:=k+l; repeat sl(k,l,m); l:=l+2*k;m:=m+2*k; until (l>=n); k:=k*2;
for i:=1 to n do begin a[i]:=b[i];a1[i]:=b1[i];a2[i]:=b2[i];a3[i]:=b3[i]; end;
until (k>=n);
end;

  function nod(a,b:int64):int64; var p,t:int64;
begin
a:=abs(a); b:=abs(b);
if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
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  max(a,b:int64):int64;
 begin max:=a; if b>a then max:=b; end;
  function  min(a,b:int64):int64;
 begin min:=a; if b<a then min:=b; end;

procedure udal(tttt:longint);
begin  next[prev[tttt]]:=next[tttt]; prev[next[tttt]]:=prev[tttt];  end;

begin
 { assign(input,'input.txt');reset(input);
  assign(output,'output.txt');rewrite(output);
  }
 readln(pp);

   for i:=1 to pp do read(a[i]);
 n:=1;

 while n<pp do n:=n*2;
  for i:=pp+1 to n do a[i]:=besk;
  sort(a);
 { for i:=1 to pp do write(a[i],' ');  writeln;
  }
  flag:=false;
  for i:=1 to pp-2 do
   if a[i+2]<a[i]+a[i+1] then flag:=true;

   if flag then write('YES') else write('NO');

 1: close (output);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, i: integer;
  a: array [0..1000000] of integer;

function min(a, b: int64): int64;
begin
  if (a > b) then min := b else min := a;
end;

function max(a, b: int64): int64;
begin
  if (a > b) then max := a else max := b;
end;

procedure qsort( min, max: Integer);
var
  i, j : integer;
  sd, t: integer;
begin
  sd:=a[max-((max-min) div 2)];
  i:=min; j:=max;
  while i<j do
  begin
    while a[i] < sd do i:=i+1;
    while a[j] > sd do j:=j-1;
    if i<=j then
      begin
        t:=a[i]; a[i]:=a[j]; a[j]:=t;
        i:=i+1; j:=j-1;
      end;
  end;
  if min<j then qsort(min, j);
  if i<max then qsort(i, max);
end;

begin
   readln(n);
   for i := 1 to n do read(a[i]);
   qsort(0, n);
   for i := 1 to n do
     if(a[i - 1] + a[i - 2] > (a[i])) and (i >= 3) then
     begin
       writeln('YES');
       halt(0);
     end;
   writeln('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g, f, x:integer;
   a: array [0..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   if (n >= 45) then
     writeln('YES')
   else begin
   for i := 1 to n do begin
    for j := i + 1 to n do begin
      for x := j + 1 to n do begin
       if (a[i] + a[x] > a[j]) and (a[j] + a[x] > a[i]) and (a[i] + a[j] > a[x]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
       if (g = 1) then
         break;
      end;
      if (g = 1) then
        break;
    end;
    if (g = 1) then
     break;
   end;
   if (g = 0) then
     writeln('NO');
   end;
   readln;
end.

var
a:array [1..100008] of integer;
n,x,b1,b2:int64;
i,j,h:integer;

procedure QuickSort( L, R : Integer ); { ������� ���������� ������� A[] }
var i,j,x,y : integer;
begin
  i := l; j := r;
  x := a[(l+r) div 2];
  repeat
    while (A[i] < x) do inc(i);
    while (x < A[j]) do dec(j);
    if ( i <= j ) then
    begin
      y:=A[i]; a[i]:=a[j]; a[j]:=y;
      inc(i); dec(j);
    end;
  until (i > j);
  if (l < j) then QuickSort(l,j);
  if (i < r) then QuickSort(i,r);
end;
begin
 readln(n);

 for i:=1 to n do
 read(a[i]);
 QuickSort( 1, n );

  for i:=1 to n-2 do
  if (a[i]+a[i+1]>a[i+2]) then begin h:=1; break; end;

  if h=1 then writeln('YES') else writeln('NO');
 readln;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014000]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure swap(var q,c:longint);
var i:longint;
    begin
    i:=q; q:=c; c:=i;
    end;

procedure qcsort(q,c:longint);
var x,h,e,d:longint;
    ass:boolean;
    begin
    x:=q+random(c-q+1);
    swap(qc[q],qc[x]);
    if q>=c then exit;
    h:=q; e:=c; d:=1;
    while h+d<=e do
      begin
      if qc[h]=qc[h+d] then inc(d) else
      if qc[h]<qc[h+d] then
        begin swap(qc[h+d],qc[e]); dec(e); end
      else begin swap(qc[h],qc[h+d]); inc(h); end
      end;
    qcsort(q,h-1);
    qcsort(h+d,c);
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  randseed:=37284;
  readln(n);
  for i:=1 to n do
    read(qc[i]);
  qcsort(1,n);
  for i:=1 to n-2 do
    if qc[i]+qc[i+1]>qc[i+2] then begin writeln('YES'); halt; end;
  writeln('NO');

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

 const
      MAXN = 100000;

    var
      a: array [1..MAXN] of longint;

    procedure swap(var a, b: longint);
    var
      temp: longint;
    begin
      temp := a;
      a := b;
      b := temp;
    end;

    procedure quicksort(l, r: longint);
    var
      border, i: longint;
    begin
      if l < r then begin
        border := l;
        for i := l to r - 1 do
          if (a[i] < a[r]) then begin
            swap(a[border], a[i]);
            inc(border);
          end;
        swap(a[border], a[r]);
        quicksort(l, border - 1);
        quicksort(border + 1, r);
      end;
    end;

    var
      n, i,b: longint;

    begin
      read(n);
      for i := 1 to n do
        read(a[i]);
     if n>60 then begin
     write('YES');
     Halt;
     end;
      quicksort(1, n);
 for b:=1 to n-2 do begin
if (a[b]+a[b+1]>a[b+2]) and (a[b+1]+a[b+2]>a[b]) and (a[b]+a[b+2]>a[b+1]) then begin
write('YES');
Halt;
end;
end;
write('NO');
end.

program otrezki;
var
n,i: int64;
first,last,start,final,j,min,y,z: int64;
a,b: array[1..100001] of int64;
flag: boolean;
procedure Merge(first,last: int64);
  var
  i: int64;
  begin
  start:=first;
  final:=(first+last) div 2+1;
  for i:=first to last do
    begin
    if (start <= (first+last) div 2) and ((final > last) or (a[start] < a[final])) then
      begin
      b[i]:=a[start];
      inc(start);
      end else
      begin
      b[i]:=a[final];
      inc(final);
      end;
    end;
  for i:=first to last do a[i]:=b[i];
  end;

procedure MergeSort(first, last: int64);
  begin
  if first < last then
  begin
  MergeSort(first,(first+last) div 2);
  MergeSort((first+last) div 2+1,last);
  Merge(first, last);
  end;
  end;
procedure FindLowestTriangle;
  begin
  i:=1;
  j:=3;
  while j<=N do
   begin
   if (a[i]+a[i+1] > a[j]) and (a[j]+ a[i] > a[i+1]) and (a[j] + a[i+1] > a[i]) then
    begin
    flag:=true;
    exit;
    end;
   inc(i);
   inc(j);
   end;
  end;
begin
read(n);
for i:=1 to N do
  read(a[i]);
MergeSort(1,N);
FindLowestTriangle;
if flag then write('YES') else write('NO');
end.

  program z1;
  var n,i,j,h:int64;
  a:array [1..100000] of int64;
  procedure quicksort(l,r:int64);
  var i,j,x,y:int64;
  begin
    i := l;
    j := r;
    x := a[(l+r) div 2];
    repeat
      while a[i]<x do inc(i);
      while a[j]>x do dec(j);
      if i<=j then begin
        y:=a[i]; a[i]:=a[j]; a[j]:=y; inc(i); dec(j);
      end;
    until i>j ;
    if l<j then quicksort(l,j);
    if i<r then quicksort(i,r);
    end;
    begin
    readln(n);
    for i:=1 to n do read(a[i]);
    quicksort(1,n);
    for i:=1 to n-2 do begin
      if a[i+2]<a[i]+a[i+1] then begin
        writeln('YES');
        exit;
      end;
    end;
    writeln('NO');
  end.

var
n: integer;
a:array of integer;
 label 1;
Begin
readln (n);
setlength (a,n);
for VAR i:=0 to n-1 do
read (a[i]);
sort (a);
 for var i:=0 to n-3 do
if a[i]+a[i+1]> a[i+2] then goto 1;

writeln('NO');
exit;
1:
writeln('YES');
end.

type tArray = Array [1..100000] of LongInt;

procedure mSort (var a: tArray; n: LongInt);
var tmp: tArray;

  procedure merge (al, ar, bl, br: LongInt);
  var i, j, k: LongInt;
  begin

	i := al;
	j := bl;
	k := 0;

	while (i <= ar) and (j <= br) do
	begin
      inc (k);
	  if (a[i] < a[j]) then
	  begin
	    tmp[k] := a[i];
		inc (i);
	  end
	  else
	  begin
	    tmp[k] := a[j];
		inc (j);
	  end;
	end;

	while (i <= ar)  do
	begin
	  inc (k);
	  tmp[k] := a[i];
	  inc (i);
	end;

	while (j <= br)  do
	begin
	  inc (k);
	  tmp[k] := a[j];
	  inc (j);
	end;

	for i := 1 to k do
	begin
	  a[al+i-1] := tmp [i];
	end;

  end;

  procedure sort (l, r: LongInt);
  var med: LongInt;
  begin
    if (l = r) then
	  exit();
	med := (l + r) div 2;

	sort (l, med);
	sort (med+1, r);

	merge (l, med, med+1, r);

  end;

begin
  sort (1, n);
end;

var a: tArray;
    n, i: LongInt;
	res: String;

begin

  readln (n);
  for i := 1 to n do
  begin
    read (a[i]);
  end;

  res := 'NO';
  mSort (a, n);

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

  writeln (res);

end.

var a:array[1..100000] of longint;
    i,n:longint;

procedure QSort(first,last:longint);
 var L,R,X,c:longint;
 begin
   if first<last then
     begin
        X:=A[(first+last) div 2];
        L:=first;
        R:=last;
        while L<=R do
          begin
            while A[L]<X do inc(L);
            while A[R]>X do dec(R);
            if L<=R then
               begin
                  c:=A[R]; A[R]:=A[L]; A[L]:=c;
                  inc(L); dec(R);
               end;
          end;
       QSort(first,R);
       QSort(L,last);
     end;
 end;

begin
read(n);
for i:=1 to n do
  read(a[i]);
QSort(1,n);
for i:=1 to n-2 do
  if a[i+2]<a[i+1]+a[i] then
     begin
       write('YES');
       exit;
     end;
write('NO');
end.

procedure QSORT(var A:array of integer);
   procedure sort(const l,h:integer);
   var i,j,pivot,b:integer;
   begin
      if l < h then
      begin
         pivot:=A[random(h-l+1)+l];
         i:=l; j:=h;
         while i < j do
         begin
            while A[i] < pivot do inc(i);
            while pivot < A[j] do dec(j);
            if i <= j then begin
               b:=A[i];
               A[i]:=A[j];
               A[j]:=b;
               inc(i); dec(j);
            end
         end;
         sort(l,j);
         sort(i,h);
      end
   end;
begin
   randomize;
   sort(0,high(A));
end;
var A:array of integer; i,n:integer;
BEGIN
   read(n);
   setlength(A,n);
   for i:= 0 to n-1 do read(A[i]);
   Qsort(A);
   for i:=high(A) downto 2 do
      if a[i]<a[i-1]+a[i-2] then begin
         write('YES');
         exit;
      end;
   write('NO');
END.

var a:array[1..100007] of longint;
	h,p,n:longint;

procedure qs(l,r:longint);
	var i,j,x,w,ind:longint;
begin
	i:=l;
	j:=r;
	randomize;
	ind:=random(r-l+1)+l;
	x:=a[ind];
	repeat
		while a[i] < x do inc(i);
		while a[j] > x do dec(j);
		if i <= j then 	begin
							w:=a[i];
							a[i]:=a[j];
							a[j]:=w;

							inc(i); dec(j);
						end;
	until i>j;
	if l < j then qs(l,j);
	if i < r then qs(i,r);
end;

begin
	readln(n);
	for h:=1 to n do
		read(a[h]);
	p:=0;
	qs(1,n);
	for h:=1 to n-2 do
		if (a[h] + a[h+1] > a[h+2]) then begin p:=1; break; end;

	if p=1 then writeln('YES')
			else writeln('NO');
end.

var i,n,x,y,z:longint;
a:array[1..100050] of longint;
procedure qsort(l,r: longint);
var i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
        while a[i]<x do
                inc(i);
        while x<a[j] do
                dec(j);
        if not(i>j) then begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
        end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
function test(a,b,c:longint):boolean;
begin
if (a+b>c)and(b+c>a)and(c+a>b) then test:=true else test:=false;
end;
begin
read(n);
for i:=1 to n do begin
        read(a[i]);
end;
qsort(1,n);
for i:=3 to n do begin
        if test(a[i-2],a[i-1],a[i]) then begin
                write('YES');
                exit;
        end;
end;
write('NO');
end.

program z1;
type tlist = array[1..100000] of longint;
var a:tlist;
    n,i:longint;
procedure qsort(var a : tlist);

    procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[l + random(r-l+1)];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

    begin
       sort(1,n);
    end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
qsort(a);
for i:=3 to n do
begin
if (a[i-1]+a[i-2]>a[i]) then
begin
write('YES');
exit;
end;
end;
write('NO');
end.

program pr1;
var
a:array[1..100000]of longint;
n,m,k,l,i,j:longint;
     function sravn(x,y,z:longint):byte;
     begin
     if (x+y>z)and(x+z>y)and(z+y>x) then sravn:=1 else sravn:=0;
     end;
procedure sort(l,r: longint);
var
i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-1;
end;
until i>j;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
end;
     begin
     readln(n);
     for i:=1 to n do
     read(a[i]);
     sort(1,n);
     for i:=1 to n-2 do
     if sravn(a[i],a[i+1],a[i+2])=1 then k:=k+1;
     if k=0 then writeln('NO')else writeln('YES');
     end.

var
a:array[0..100000] of longint;
n,i,p:longint;
 procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;
 function bin(l,x:longint):longint;
  var r,mid:longint;
  begin
   r:=n;
   while r-l>1 do
    begin
     mid:=(r+l) div 2;
     if a[mid]>=x then r:=mid
     else l:=mid;
    end;
    if a[l]<x then bin:=l
    else bin:=0;
  end;
begin
 readln(n);
 for i:=1 to n do
  read(a[i]);
 sort(1,n);
 for i:=1 to n-2 do
  begin
   p:=bin(i+2,a[i]+a[i+1]);
   if (p<>0)and (p>i+1) then begin
                 writeln('YES');
                 halt;
                end;
  end;
 writeln('NO');
end.

var a:array[1..100000] of longint;
i,j,k,n:longint;
ok: boolean;

procedure sort(l,r:longint);
var i,j,x,tmp:longint;
begin
    i:= l; j:= r; x:=a[(l+r) div 2];
    repeat
        while (a[i]<x) and (i<=j) do inc(i);
        while (a[j]>x) and (j>=i) do dec(j);
        if i<=j then
            begin
            tmp:= a[i]; a[i]:=a[j]; a[j]:= tmp;
            inc(i); dec(j);
            end;
    until i>j;
        if i<r then sort(i,r);
        if l<j then sort(l,j);
end;
begin
    readln(n);
    for i:= 1 to n do read(a[i]);
    readln;
    sort(1,n);
    ok:= true;
    for i:= 1 to n-2 do
        if a[i+2]<a[i]+a[i+1] then
        begin write('YES'); ok:= false; exit; end;
    if ok then write('NO');
end.

program Triangle;

var i, j, n : Longint;
        a : Array [1..100000] of Longint;
        found : Boolean;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

function test(m, k, p : Longint):Boolean;
        begin
        if (m+k>p)and(m+p>k)and(p+k>m) then exit(True) else
        exit(False);
        end;

BEGIN
readln(n);
for i:=1 to n do
        read(a[i]);

sort(1, n);

for i:=1 to n-2 do
        if test(a[i], a[i+1], a[i+2])=True then
                begin
                found := True;
                break;
                end;

if found=True then writeln('YES') else
        writeln('NO');

END.

var a:array[1..100010] of longint;
i,j,n:longint;
b,c,d:int64;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

begin
  readln(n);
  for i:=1 to n do
   read(a[i]);

  sort(1,n);

  for i:=n downto 3 do
   begin
    b:=a[i];
    c:=a[i-1];
    d:=a[i-2];
    if (c+d>b) and (b+c>d) and (b+d>c) then begin
                                             writeln('YES');
                                             halt;
                                            end;
   end;
  writeln('NO');
end.

var a:array[1..100000] of longint;
    i,n:longint;
    data:boolean;
Procedure QuickSort(L,R : longint);
  var
    i, j, x, t : longint;
  begin
    i := L; j := R; x:=a[L+random(R-L+1)];//x := a[(L+R) div 2];
    repeat
      while a[i] < x do i := i + 1;
      while a[j] > x do j := j - 1;
      if i<=j
         then begin
                t := a[i]; a[i] := a[j]; a[j] := t;
                i := i + 1; j := j - 1;
              end;
    until i>j;
    if L<j then QuickSort(L,j);
    if i<R then QuickSort(i,R);
  end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
quicksort(1,n);
for i:=1 to n-2 do
if (a[i+2]<a[i]+a[i+1])and(a[i]>abs(a[i+1]-a[i+2]))and
(a[i+1]>abs(a[i]-a[i+2]))
and(a[i+2]>abs(a[i]-a[i+1])) then begin data:=true; break; end;
if data then writeln('YES')
else writeln('NO');
end.

var a: array of longint;
i,n: longint;
b: boolean;

   procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

begin
read(n); setlength(a,n);
for i:=0 to n-1 do read(a[i]);
sort(0,n-1);
for i:=0 to n-3 do
if a[i]+a[i+1]>a[i+2] then
begin
b:=true;
break;
end;
if b<>true then write('NO') else write('YES');
readln;
end.

Program CodeF_396_B;
var mas:array[1..100000]of int64;
    i,n,t:longint;
procedure swap(var a,b:int64);
var c:int64;
begin
  c:=a;
  a:=b;
  b:=c;
end;

Procedure q_sort2(a,b:longint);
var p,i,j:longint;
    q:int64;
begin
if b-a>1 then
  begin
    p:=random(b-a+1)+a;
    q:=mas[p];
    swap(mas[p], mas[a]);
    i:=a+1;
    j:=b;
      while i<j do
        begin
          while (mas[i]<=q) and (i<b) do inc(i);
          while mas[j]>q  do dec(j);
          if i<j then swap(mas[i], mas[j]);
        end;
    swap(mas[a], mas[j]);
    q_sort2(a, j-1);
    q_sort2(j+1, b);
  end                 else
    if (b-a=1) and (mas[a]>mas[b]) then swap(mas[a],mas[b]);

end;

begin
read(n);
for i:=1 to n do
  read(mas[i]);
for i:=1 to n-2 do
  if (mas[i+2]<mas[i]+mas[i+1]) and (mas[i]<mas[i+2]+mas[i+1]) and (mas[i+1]<mas[i]+mas[i+2]) and (t=0) then t:=1;
if t=0 then q_sort2(1,n);

for i:=1 to n-2 do
  if (mas[i+2]<mas[i]+mas[i+1]) and (t=0) then t:=1;
if t=1 then write('Yes') else write('No');

end.

var i,j,i1,n:longint;
    f:boolean;
    a:array[1..100000] of longint;
begin
 readln(n);
 f:=false;
 for i:=1 to n do
  read(a[i]);
 if n<=5000 then
 for i:=1 to n-2 do
  for j:=i+1 to n-1 do
   for i1:=j+1 to n do
    if (a[i]+a[j]>a[i1])and(a[i1]+a[j]>a[i])and(a[i]+a[i1]>a[j]) then
    begin
     f:=true;
     break;
    end;
 if n>5000 then
 f:=true;
 if f then
 writeln('YES') else
 writeln('NO');
end.

var
        n,i:longint;
        a:array[0..100000] of longint;
procedure kp(x,y:longint);
var
        l,r,m:longint;
begin
        l:=x;
        r:=y;
        m:=a[(l+r)>>1];
        repeat
                while a[l]<m do inc(l);
                while a[r]>m do dec(r);
                if l<=r then begin
                        a[0]:=a[l];
                        a[l]:=a[r];
                        a[r]:=a[0];
                        inc(l);
                        dec(r);
                end;
        until l>r;
        if l<y then kp(l,y);
        if x<r then kp(x,r);
end;
begin
        readln(n);
        for i:=1 to n do read(a[i]);
        kp(1,n);
        for i:=1 to n-2 do begin
                if a[i]+a[i+1]>a[i+2] then begin
                        writeln('YES');
                        exit;
                end;
        end;
        writeln('NO');
end.

var
  a,b: array[1..100000] of longint;
  i,n,j,r: longint;
label
  m1;
procedure sort(l,r: longint);
  var
    key,buf,i1,j1: longint;
  begin
    key:=a[(l+r) div 2];
    i1:=l;
    j1:=r;
    repeat
      while a[i1]<key do inc(i1);
      while a[j1]>key do dec(j1);
      if i1<=j1 then
                  begin
                    buf:=a[i1];
                    a[i1]:=a[j1];
                    a[j1]:=buf;
                    inc(i1);
                    dec(j1);
                  end;
    until i1>j1;
    if l<j1 then sort(l,j1);
    if i1<r then sort(i1,r);
  end;
BEGIN
  randomize;
  readln(n);
  for i:=1 to n do
    read(a[i]);
  if n<=500 then
              begin
                for i:=1 to n-1 do
                  for j:=i+1 to n do
                    if a[i]>a[j] then
                                   begin
                                     r:=a[i];
                                     a[i]:=a[j];
                                     a[j]:=r;
                                   end
                                 else sort(1,n);
              end;
  {for i:=1 to n do
    write(a[i],' ');}
  for i:=3 to n do
    if a[i-2]+a[i-1]>a[i] then
                            begin
                              writeln('YES');
                              halt(0);
                            end;

  writeln('NO');
  {m1:}
END.

 var i,n,j,r:longint;
  a:array [1..100000] of longint;
   procedure qsort (L,R:longint);
    var ii,jj,x,m:longint;
     begin
     ii:=L;
     jj:=R;
      m:=a[(L+R) div 2];
       while ii<=jj do
        begin
         while a[ii]<m do inc (ii);
         while a[jj]>m do dec (jj);
          if ii<=jj then begin
                          x:=a[ii];
                          a[ii]:=a[jj];
                          a[jj]:=x;
                          inc (ii);
                          dec (jj);
                         end;

        end;
      if L<jj then qsort (L,jj);
      if ii<R then qsort (ii,R);
     end;
  begin
   read (n);
    for i:=1 to n do
    read (a[i]);

     qsort (1,n);
  i:=0;
   while i<=n-2 do
    begin
     inc (i);
       j:=i+1;
     while j<=n-1 do
      begin
        r:=j+1;
       while r<=n do
        begin
          if a[i] + a[j] <= a[r] then
           begin
            inc (j);
            inc (r);
           end
             else
           begin
            writeln ('YES');
             halt;
           end;

        end;
      end;
    end;

     writeln ('NO');

  end.

program _766B;
var
  a : array[1..100000] of longint;
  n, i, t : longint;
procedure QSort(L, R : longint);
  var
    i, j, x, t : longint;
  begin
    i := L; j := R; x := a[L + random(R - L + 1)];
    repeat
      while a[i] < x do inc(i);
      while a[j] > x do dec(j);
      if i <= j
         then begin
                t := a[i]; a[i] := a[j]; a[j] := t;
                inc(i); dec(j);
              end;
    until i > j;
    if L < j then QSort(L, j);
    if i < R then QSort(i, R);
  end;
begin
  read(n);
  for i := 1 to n do
    read(a[i]);
  QSort(1, n);
  t := 0;
  for i := 3 to n do
    if a[i] < a[i - 1] + a[i - 2]
       then begin
              t := 1; break;
            end;
  if t = 1
     then write('YES')
     else write('NO');
end.

var n,k,x,i,m:longint;
    a,h:array[0..100001] of int64;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

procedure add(x:longint);
  var i:longint;
  begin
    n:=n+1;
    i:=n;
    h[0]:=x;
    while x<h[i div 2] do
      begin
        h[i]:=h[i div 2];
        i:=i div 2;
      end;
    h[i]:=x;
  end;

function del:longint;
  var d,i,l,c:longint;
  begin
    d:=h[1];
    l:=h[n];
    n:=n-1;
    i:=1;
    k:=0;
    while (2*i<=n)and(k=0) do
      begin
        c:=2*i;
        if c<n then
          if h[c+1]<h[c] then c:=c+1;
        if l>h[c] then
          begin
            h[i]:=h[c];
            i:=c;
          end else k:=1;
      end;
    h[i]:=l;
    del:=d;
  end;

begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);   }
readln(m);
for i:=1 to m do
  begin
    read(x);
    add(x);
  end;
for i:=1 to m do a[i]:=del;
x:=0;
for i:=2 to m-1 do
  if (a[i]<a[i-1]+a[i+1])and(a[i-1]<a[i]+a[i+1])and(a[i+1]<a[i]+a[i-1])
    then x:=1;
if x=1 then write('YES') else write('NO');
end.

var A:ARRAY[1..300000]OF LONGINT;
    N,I:LONGINT; CHECK:BOOLEAN;
procedure sort(l,r:longint);
var x,i,j,t:longint;
begin
   i:=l;
   j:=r;
   x:=a[random(r-l+1)+l];
   repeat
      while x<a[i] do inc(i);
      while x>a[j] do dec(j);
      if i<=j then
         begin
         t:=a[i];
         a[i]:=a[j];
         a[j]:=t;
         inc(i);
         dec(j);
         end;
   until i>j;
if i<r then sort(i,r);
if l<j then sort(l,j);
end;

function tr(a,b,c:longint):boolean;
begin
   if (a+b>c) and (a+c>b) and (b+c>a) then tr:=true else tr:=false;
end;
begin
   read(n);
   for i:=1 to n do
      read(a[i]);
   sort(1,n);
   check:=false;
   for i:=1 to n-2 do
      if tr(a[i],a[i+1],a[i+2]) then check:=true;
   if check then write('YES') ELSE WRITE('NO');
END.

var i,n: longint;
    a: array[1..100000] of longint;
procedure qsort(l,r: longint);
var i,j,m,t,x: longint;
begin
    i:=l;
    j:=r;
    m:=(l+r) div 2;
    x:=a[m];
    while (i<=j) do
    begin
        while (a[i]<x) do inc(i);
        while (a[j]>x) do dec(j);
        if i<=j then
        begin
            t:=a[i];
            a[i]:=a[j];
            a[j]:=t;
            inc(i);
            dec(j);
        end;
    end;
    if (l<j) then qsort(l,j);
    if (i<r) then qsort(i,r);
end;
begin
    readln(n);
    for i:=1 to n do read(a[i]);
    qsort(1,n);
    for i:=2 to n-1 do
        if (a[i-1]+a[i])>a[i+1] then
        begin
            write('YES');
            exit;
        end;
    write('NO');
end.

var a,q:Array[1..100000] of longint;
    n,i,i1,i2:longint;
procedure mergesort(l,r:longint);
 var x:longint;
 begin
  if l<r
   then begin
         x:=(l+r) div 2;
         mergesort(l,x);
         mergesort(x+1,r);
         i1:=l;
         i2:=x+1;
         for i:=l to r do
          if (i1<=x) and ((i2>r) or (a[i1]<a[i2]))
           then begin
                 q[i]:=a[i1];
                 inc(i1);
                end
           else begin
                 q[i]:=a[i2];
                 inc(i2);
                end;
         for i:=l to r do
          a[i]:=q[i];
        end;

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

Program Triangle;
uses math;
Type arr=array[0..100007] of longint;
var a:arr; n,i,j:longint;
Procedure Sort(l,r:longint);
var i,j,x,tmp:longint;
begin   i:=l; j:=r; x:=a[(i+j) div 2];
        repeat
        while a[i]<x do inc(i);
        while a[j]>x do dec(j);
        if i<=j then begin
        tmp:=a[i]; a[i]:=a[j]; a[j]:=tmp;
        inc(i); dec(j);
        end;
        until i>j;
        if l<j then sort(l,j);
        if r>i then sort(i,r);
end;
Procedure Degenerate;
var l,r,g:longint;
begin   Sort(1,n);
        for i:=1 to n-2 do
        for j:=i+1 to n-1 do
        begin   l:=j+1; r:=n;
                while l<=r do
                begin   g:=(l+r) div 2;
                        if a[g]<a[i]+a[j] then begin
                        writeln('YES'); exit;
                        end else r:=g-1;
                end;
        end;
        writeln('NO');
end;
begin   //assign(input,'766B.inp'); reset(input);
        //assign(output,'766B.out'); rewrite(output);
        readln(n);
        for i:=1 to n do read(a[i]);
        Degenerate;
        //close(input); close(output);
end.

var
    a,i,z:longint;
    v: array [1..100000] of longint;

procedure qSort(l,r:longint);
var i,j:longint;
    w,q:longint;
begin
  i := l; j := r;
  q := v[(l+r) div 2];
  repeat
    while (v[i] < q) do inc(i);
    while (q < v[j]) do dec(j);
    if (i <= j) then
    begin
      w:=v[i]; v[i]:=v[j]; v[j]:=w;
      inc(i); dec(j);
    end;
  until (i > j);
  if (l < j) then qSort(l,j);
  if (i < r) then qSort(i,r);
end;

begin
    readln(a);
    z := 0;
    for i:= 1 to a do read(v[i]);

    qSort(1,a);

    for i := 1 to a-2 do begin
        if (v[i] + v[i+1] > v[i+2]) then z:=1;
    end;

    if (z = 1) then writeln('YES') else writeln('NO');
end.

var a,s,d,f,g,h,j,k:int64;
i,ii:longint;
z,x:array[1..1000000]of int64;
procedure qsort(l,r:longint);
var l1,r1,e,t:longint;
begin
l1:=l;
r1:=r;
e:=z[random(r-l)+l];
repeat;
while e>z[l1] do inc(l1);
while e<z[r1] do dec(r1);
if l1<=r1 then
begin
t:=z[l1];
z[l1]:=z[r1];
z[r1]:=t;
inc(l1);
dec(r1);
end;
until l1>r1;
if l<r1 then qsort(l,r1);
if l1<r then qsort(l1,r);
end;
begin
readln(a);
for i:=1 to a do
read(z[i]);
qsort(1,a);
for i:=1 to a-2 do
if (z[i]+z[i+1]>z[i+2])and(z[i]+z[i+2]>z[i+1])and(z[i+1]+z[i+2]>z[i]) then
begin
writeln('YES');
halt;
end;
writeln('NO');
end.

var i,n,f:longint;
    a:array[0..102005]of longint;

procedure sort(l,r:longint);
var i,j,x,b:longint;
begin
    i:=l;
    j:=r;
    x:=a[l+random(r-l+1)];
    while i<=j do
        begin
            while x<a[i] do inc(i);
            while x>a[j] do dec(j);
            if i<=j then
                begin
                    b:=a[i];
                    a[i]:=a[j];
                    a[j]:=b;
                    inc(i); dec(j);
                end;
        end;
    if i<r then sort(i,r);
    if l<j then sort(l,j);
end;

begin
    readln(n);
    for i:=1 to n do read(a[i]);
    sort(1,n);
    f:=0;
    for i:=1 to n-2 do
        begin
            if a[i]<a[i+1]+a[i+2] then f:=1;
        end;
    if f=1 then writeln('YES') else writeln('NO');
end.

Program drg;
Type myarr=array [1..100000] of int64;

Procedure MergeSort(Var a:myarr;n:longint);
Var b:myarr;

  Procedure Merge(l,r:longint);
  Var c,i,j,k:longint;
  Begin
    if l=r then exit;
    c:=(l+r) div 2;
    j:=c+1;
    Merge(l,c);
    Merge(j,r);
    i:=l;
    k:=l;
    While (i<=c)and(j<=r) do begin
      if a[i]<=a[j] then begin
        b[k]:=a[i];
        Inc(i);
      End
      Else begin
        b[k]:=a[j];
        inc(j);
      End;
      inc(k);
    End;
    j:=r;
    While (i<=c) do begin
      a[j]:=a[c];
      Dec(c);
      Dec(j);
    End;
    for i:=l to k-1 do a[i]:=b[i];
  END;

Begin
  Merge(1,n);
End;

Var n,i:longint;
    a:myarr;

Begin
  readln(n);
  For i:=1 to n do Read(a[i]);
  MergeSort(a,n);
  For i:=3 to n do  if (a[i]<a[i-1]+a[i-2])and(a[i]>a[i-1]-a[i-2]) then begin
    Writeln('YES');
    Halt;
  end;
  Writeln('NO');
End.

Const fi='';
      fo='';
Var  n:longint;
    a:array[-10..100000] of longint;
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 sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

Procedure xuly;
    Var i,j,k:longint;
    begin
        sort(1,n);
        if n = 3 then
                begin
                    i:=2;
                    j:=3;
                    k:=4;
                end;
        i:=n-1; j:=n; k:=n+1;
        While i>0 do
            begin
                i:=i-1; j:=j-1; k:=k-1;
                if (a[i] + a[k]>a[j]) and (abs(a[i]-a[k])<a[j]) and (a[i]+a[j]>a[k]) and (a[j]+a[k]>a[i]) and (a[j]-a[k]<a[i]) and (a[i]-a[j]<a[k]) then
                    begin
                        Write('YES');
                        exit;
                    end;

            end;
         Write('NO');
    end;

BEGIN
    assign(output,fo); rewrite(output);
    nhap;
    xuly;
    Close(output);
END.

program zzz;
var
  n,i,j,c:longint;
  a:array[1..100010]of longint;
  b:boolean;
procedure Qsort(l,r:longint);
  var
    i,j,x,z:longint;
  begin
    i:=l;
    j:=r;
    x:=a[random(r-l+1)+l-1];
    repeat
      while a[i]<x do inc(i);
      while a[j]>x do dec(j);
      if i<=j then
      begin
        z:=a[i];
        a[i]:=a[j];
        a[j]:=z;
        inc(i);
        dec(j);
      end;
    until i>j;
    if l<j then Qsort(l,j);
    if i<r then Qsort(i,r);
  end;
begin
  readln(n);
  for i:=1 to n do
    read(a[i]);
  Qsort(1,n);
  i:=1;

  b:=false;
  while (b=false) and (i<=n-2)  do
  begin
    j:=i+1;
    c:=i+2;
    if (a[i]+a[j]>a[c]) and (a[i]+a[c]>a[j]) and (a[c]+a[j]>a[i])  then
      b:=true;
    inc(i);
  end;
  if b=true then
    writeln('YES')
  else
    writeln('NO');
end.

var dlina : array[1..100000] of Integer;

function Partition(l,r: integer): integer;
var i, j, x, stak : Integer;
begin
  i := l - 1;
  j := r + 1;
  x := dlina[l];
  while True do
  begin
    repeat
      i += 1;
    until dlina[i]>=x;
    repeat
      j -= 1;
    until dlina[j]<=x;
    if i<j then begin
                  stak := dlina[i];
                  dlina[i] := dlina[j];
                  dlina[j] := stak;
                end
    else
    begin
      Result := j;
      exit;
    end;
  end;
end;

/// ���������� ������
procedure QuickSort(l,r: integer);
var j : Integer;
begin
  if l>=r then exit;
  j := Partition(l,r);
  QuickSort(l,j);
  QuickSort(j+1,r);
end;

var n, i, ab, ac, bc, a, b, c : Integer;
begin
  readln(n);
  For i := 1 to n do read(dlina[i]);
  QuickSort(1,n);
  For i := 1 to n - 2 do
    begin
      a := dlina[i + 2];
      b := dlina[i + 1];
      c := dlina[i];
      If b + c > a then begin
                       writeln('YES');
                       exit;
                     end;
    end;
  writeln('NO');
end.

{$OPTIMIZATION LEVEL2}
{$INLINE ON}
uses math;
const log=18;
      ms=1e-9;
      oo=round(1e9);
      modulo=1000000007;
      fi='';
      fo='';
      maxn=100010;

var f1,f2:text;
    n:longint;
    a:array[0..maxn]of longint;

procedure openfile;
 begin
  assign(f1,fi);
  reset(f1);
  assign(f2,fo);
  rewrite(f2);
 end;

procedure closefile;
 begin
  close(f1);
  close(f2);
 end;

procedure input;
 var i:longint;
 begin
  readln(f1,n);
  for i:=1 to n do
   read(f1,a[i]);
 end;

procedure sort(l,r:longint);
 var i,j,x,y:longint;
 begin
  x:=a[random(r-l-1)+l+1];
  i:=l;j:=r;
  repeat
   while a[i]<x do inc(i);
   while a[j]>x do dec(j);
   if i<=j then
    begin
     y:=a[i];a[i]:=a[j];a[j]:=y;
     inc(i);dec(j);
    end;
  until i>j;
  if i<r then sort(i,r);
  if l<j then sort(l,j);
 end;

procedure init;
  var i,j:longint;

  begin
   sort(1,n);
  end;

procedure solve;
  var i,j:longint;
  begin
   for i:=3 to n do
    if (a[i-1]+a[i-2]>a[i]) then
    begin
     writeln(f2,'YES');
     closefile;
     halt;
    end;
   writeln(f2,'NO');
  end;

procedure output;
  var i:longint;
  begin

  end;

begin
 openfile;
 input;
 init;
 solve;
 output;
 closefile;
end.

type manglon=array[0..100001] of int64;
var A:manglon;
	sort:boolean;
	i:int32;
	n:int64;

procedure QuickSort(var AI: manglon; ALo, AHi: int64);
var
  Lo, Hi, Pivot, T: int64;
begin
  Lo := ALo;
  Hi := AHi;
  Pivot := AI[(Lo + Hi) div 2];
  repeat
    while AI[Lo] < Pivot do
      Inc(Lo) ;
    while AI[Hi] > Pivot do
      Dec(Hi) ;
    if Lo <= Hi then
    begin
      T := AI[Lo];
      AI[Lo] := AI[Hi];
      AI[Hi] := T;
      Inc(Lo) ;
      Dec(Hi) ;
    end;
  until Lo > Hi;
  if Hi > ALo then
    QuickSort(AI, ALo, Hi) ;
  if Lo < AHi then
    QuickSort(AI, Lo, AHi) ;
end;

Begin
	Readln(n);
	A[0]:=0;
	sort:=False;
	For i:=1 to n do
		Begin
			Read(A[i]);
			If (A[i]<A[i-1]) then sort:=True;
		End;
	QuickSort(A,1,n);
	For i:=1 to n-2 do if (A[i]+A[i+1]>A[i+2]) then
		Begin
			Write('YES');
			halt;
		End;
	Write('NO');
End.

var n,i:longint;
    a:array [1..100000] of longint;

Procedure quicksort (first, last:longint);
  var f,l, mid, tmp:longint;
  begin
    f:=first;
    l:=last;
    mid:=a[(f+l) div 2];
    while(f<=l) do
      begin
        while(a[f]<mid) do
          inc(f);
        while(a[l]>mid) do
          dec(l);
        if (f<=l) then
          begin
            tmp:=a[f];
            a[f]:=a[l];
            a[l]:=tmp;
            inc(f);
            dec(l);
          end;
      end;
    if first<l then
        quicksort(first, l);
    if f<last then
        quicksort(f, last);
  end;

begin
    read(n);
    for i:=1 to n do
      read(a[i]);
    quicksort(1,n);
    for i:=3 to n do
      if(a[i]<a[i-1]+a[i-2]) then begin
         write('YES');
         exit;
      end;
    write('NO');
end.

var a:array [1..100001] of longint;i,j,k,s,n:longint;
procedure sort(l,r:longint);
var m,i,j,x1:longint;
begin
 i:=l;
 j:=r;
 m:= round ((l+r)/2);
 x1:=a[m];
 repeat
  while a[i]<x1 do inc(i);
  while a[j]>x1 do dec(j);
 if i<=j then
 begin
 m:=a[i];
 a[i]:=a[j];
 a[j]:=m;
 inc(i);
 dec(j);
 end;
 until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
sort(1,n);
i:=1;
j:=2;
k:=3;
while (s<>1) and (k<=n) do begin
if a[i]+a[j]>a[k] then
s:=1
else
 begin
 i:=i+1;
 j:=j+1;
 k:=k+1;
 end;
end;
if s=1 then
writeln('YES')
else
writeln('NO');
end.

var
  a : array[0..250000] of int64;
  i,j,n,m : longint;

  procedure qs(l,r : longint);
    var
      i,j : longint;
      k,t : int64;
    begin
      i:=l; j:=r;
      k:=a[l+random(r-l+1)];
      repeat
        while a[i] < k do inc(i);
        while a[j] > k do dec(j);
          if i > j then break;
        t:=a[i]; a[i]:=a[j]; a[j]:=t;
        inc(i); dec(j);
      until i > j;
      if l < j then qs(l,j);
      if i < r then qs(i,r);
    end;

begin
  readln(n);
  for i:=1 to n do read(a[i]);
  qs(1,n);
  for i:=3 to n do if (a[i]+a[i-1] > a[i-2]) and (a[i]+a[i-2] > a[i-1]) and (a[i-1]+a[i-2] > a[i]) then begin writeln('YES'); halt; end;
  writeln('NO');
end.

program z2;
var a,b,c,d,i,j,k,l,m,n:longint; Z:array[1..100000] of longint;

Procedure sort(l,r:longint);
var i,j,x,y:longint;
begin
i:=l; j:=r; x:=Z[l+random(r-l+1)];
repeat
while Z[i]<x do inc(i);
while Z[j]>x do dec(j);
if not(i>j) then
 begin
 y:=Z[i]; Z[i]:=Z[j]; Z[j]:=y;
 inc(i); dec(j);
 end;
until i>j;
if i<r then sort(i,r);
if l<j then sort(l,j);
end;

Function see(x,y,z:longint):boolean;
begin
if x+y<=z then exit(false);
if x+z<=y then exit(false);
if z+y<=x then exit(false);
exit(true);
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(n);
for i:=1 to n do read(Z[i]);
sort(1,n);
for i:=3 to n do if see(Z[i-2],Z[i-1],Z[i]) then begin write('YES'); exit; end;
write('NO');
end.

var i,j,i1,n:longint;
    f:boolean;
    a:array[1..100000] of longint;
begin
 readln(n);
 f:=false;
 for i:=1 to n do
  read(a[i]);
 if n<=5000 then
 for i:=1 to n-2 do
  for j:=i+1 to n-1 do
   for i1:=j+1 to n do
    if (a[i]+a[j]>a[i1])and(a[i1]+a[j]>a[i])and(a[i]+a[i1]>a[j]) then
    begin
     f:=true;
     break;
    end;
 if n>5000 then
 f:=true;
 if f then
 writeln('YES') else
 writeln('NO');
end.

var n,i:longint;
a:array[1..100000]of longint;
procedure Qsort(first,last:longint);
        var L,R,Temp,X:longint;
        begin
        if first<last then
                begin
                L:=first;
                R:=last;
                x:=a[(first+last) div 2];
                while L<=R do
                        begin
                        while a[l]<x do
                                inc(l);
                        while a[r]>x do
                                dec(r);
                        If l<=r then
                                begin
                                temp:=a[l];
                                a[l]:=a[r];
                                a[r]:=temp;
                                inc(l);
                                dec(r);
                                end;
                        end;
                Qsort(First,R);
                Qsort(L,Last);
                end;
        end;
begin
readln(n);
for i:=1 to n do
        read(a[i]);
Qsort(1,n);
for i:=1 to n-2 do
        if a[i]+a[i+1]>a[i+2] then
                begin
                write('YES');
                halt;
                end;
write('NO');
end.

var
  bi:boolean;
  i,j,m,n,k,p:longint;
  a:array[0..100005]of longint;
procedure qs(l,r:longint);
var
  i,j,mid,q:longint;
begin
  i:=l; j:=r;
  mid:=a[(l+r) div 2];
  repeat
    while a[i]<mid do inc(i);
    while a[j]>mid do dec(j);
    if not(i>j) then
      begin
        q:=a[i]; a[i]:=a[j]; a[j]:=q;
        inc(i); dec(j);
      end;
  until i>j;
  if i<r then qs(i,r);
  if l<j then qs(l,j);
end;
begin
  readln(n);
  for i:=1 to n do
    read(a[i]);
  qs(1,n);
  bi:=false;
  for i:=3 to n do
    begin
      if a[i]<a[i-1]+a[i-2] then
        begin
          bi:=true; break;
        end;
    end;
  if bi=true then writeln('YES')
  else
    writeln('NO');
end.

var

 a : array [0..111111] of longint;
 i,j,x,xx,n : longint;

procedure qs(l,r :longint);
begin

 i:=l; j:=r; x:=a[random(r-l+1)+l];

 while i <= j do  begin

  while a[i] < x do inc(i);
  while a[j] > x do dec(j);

  if i <= j then begin
   xx:=a[i]; a[i]:=a[j]; a[j]:=xx;
   inc(i); dec(j);
  end;
 end;

 if i < r then qs(i,r);
 if l < j then qs(l,j);
end;

begin

    readln(n);

    for i:=1 to n do
     read(a[i]);

    qs(1,n);

    i:=1;

    while i <= n-2 do begin

     if a[i]+a[i+1] > a[i+2] then
      begin
       writeln('YES');
       halt;
      end;
     inc(i);
    end;

    writeln('NO');
  end.

var
  a,b,i,n,k,j:longint;
  x:array[1..111111]of longint;
procedure sort(l,r:longint);
var i,e,j,t:longint;
begin
  i:=l;
  j:=r;
  e:=x[l+random(r-l+1)];
  while i<=j do
  begin
    while e>x[i] do inc(i);
    while e<x[j] do dec(j);
    if i<=j then
    begin
    t:=x[i];x[i]:=x[j];x[j]:=t;
    inc(i);
    dec(j);
    end;
  end;
  if i<r then sort(i,r);
  if j>l then sort(l,j);
end;
begin
  read(n);
  for i:=1 to n do
  read(x[i]);
  sort(1,n);

  for i:=1 to n-2 do
  if (x[i]+x[i+1]>x[i+2]) and (x[i]+x[i+2]>x[i+1]) and (x[i+1]+x[i+2]>x[i]) then begin writeln('YES');halt;end;
  writeln('NO');
end.

var
 i,j,n,k,l:longint;
 a:array[1..100005] of longint;
procedure swap(var a, b: longint);
var
  temp: longint;
begin
  temp := a;
  a := b;
  b := temp;
end;

procedure qs(l, r: longint);
var
  border, i: longint;
begin
  if l < r then begin
    swap(a[random(r - l + 1) + l], a[r]);
    border := l;
    for i := l to r - 1 do
      if (a[i] < a[r]) or ((a[i] = a[r]) and (random(2) = 1)) then begin
        swap(a[border], a[i]);
        inc(border);
      end;
    swap(a[border], a[r]);
    qs(l, border - 1);
    qs(border + 1, r);
  end;
end;

begin
 readln(n);
 for i:=1 to n do
  read(a[i]);
  qs(1,n);
   for i:=2 to n-1 do
    begin
     if a[i]+a[i-1]>a[i+1] then begin writeln('YES'); exit; end;
    end;
  writeln('NO');

end.

var n:longint;
v:array[1..100000] of longint;
procedure qSort(l,r:longint);
var i,j:longint;
    w,q:longint;
begin
  i := l; j := r;
  q := v[(l+r) div 2];
  repeat
    while (v[i] < q) do inc(i);
    while (q < v[j]) do dec(j);
    if (i <= j) then
    begin
      w:=v[i]; v[i]:=v[j]; v[j]:=w;
      inc(i); dec(j);
    end;
  until (i > j);
  if (l < j) then qSort(l,j);
  if (i < r) then qSort(i,r);
end;
begin
     readln(n);
     for n:=1 to n do
     read(v[n]);
     qsort(1,n);
     for n:=1 to n-2 do
     Begin
          if(v[n]+v[n+1]>v[n+2])and(v[n]+v[n+2]>v[n+1])and(v[n+1]+v[n+2]>v[n])
          then begin writeln('YES');halt;end;
     end;
     writeln('NO');
end.

var a:array[1..100000]of longint;
l,r,mid,i,j,n:longint;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

begin
  readln(n);
  for i:=1 to n do
    read(a[i]);
  sort(1,n);
  for i:=2 to n-1 do
    begin
      if a[i-1]+a[i]>a[i+1] then begin
                                   writeln('YES');
                                   halt;
                                 end;
    end;
  writeln('NO');
end.

var i,n:longint;
    a:array[1..100000] of longint;

procedure swap(var x,y:longint);
var z:longint;
begin
 z:=x; x:=y; y:=z;
end;

procedure qs(m,t:longint);
var i,j,x:longint;
begin
 i:=m; j:=t;
 x:=a[m+random(t-m+1)];
 repeat
  while a[i]<x do inc(i);
  while a[j]>x do dec(j);
  if j>=i then begin
   swap(a[i],a[j]);
   inc(i); dec(j);
  end;
 until i>j;
 if i<t then qs(i,t);
 if m<j then qs(m,j);
end;

begin
readln(n);
for i:=1 to n do read(a[i]);

qs(1,n);

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

var
   n,i,j,s : integer;
   n1 : array of integer;

procedure qsort(l, r: longint);
var
  i, j, x, y: longint;
begin
  randomize;
  i := l;
  j := r;
  x := n1[random(r - l + 1) + l];
  repeat
    while(n1[i] < x) do inc(i);
    while(n1[j] > x) do dec(j);
    if(i <= j) then
    begin
      y := n1[i];
      n1[i] := n1[j];
      n1[j] := y;
      i:=i+1; j:=j-1;
    end;

  until (i > j);
  if(l < j) then qsort(l, j);
  if(i < r) then qsort(i, r);
end;

begin
     randomize;
     readln(n);
     SetLength(n1,n);
     for i  := 0 to n-1 do
     begin
         read(n1[i]);
     end;

     qsort(0,n-1);

     for i := 0 to n-3 do
     begin
          if (n1[i] + n1[i+1]) > n1[i+2] then
          begin
          writeln('YES');
          exit;
          end;
     end;
     writeln('NO');
end.

var i, n : longint;
    a : array[1..100100] of longint;

function ran(l, r : longint) : longint;
begin
    ran := random(r - l + 1) + l;
end;

procedure swap(var x, y : longint);
var tmp : longint;
begin
    tmp := x; x := y; y := tmp;
end;

procedure qsort(l, r : longint);
var i, j, mid, key : longint;
begin
    i := l; j := r;
    mid := ran(l, r);
    key := a[mid];
    repeat
        while (a[i] < key) do inc(i);
        while (a[j] > key) do dec(j);
        if (i <= j) then
        begin
            swap(a[i], a[j]);
            inc(i); dec(j);
        end;
    until (i > j);
    if (i < r) then qsort(i, r);
    if (l < j) then qsort(l, j);
end;

begin
    readln(n);
    for i := 1 to n do read(a[i]);
    qsort(1, n);
    for i := 1 to n - 2 do
    begin
        if (a[i] + a[i + 1] > a[i + 2]) then
        begin
            writeln('YES');
            halt;
        end;
    end;
    writeln('NO');
end.

uses math;
const
	fi = '';
	fo = '';
	maxn = 100001;
var	a:array[0..maxn] of longint;
	n,i:longint;ok:boolean;
procedure QS(l,r:longint);
var i,j,x,t:longint;
begin
	i:=l; j:=r; x:=a[(l+r) div 2];
	repeat
		while a[i]<x do i:=i+1;
		while x<a[j] do j:=j-1;
		if i<=j then
		begin
			t:=a[i]; a[i]:=a[j]; a[j]:=t;
			i:=i+1; j:=j-1;
		end;
	until i>j;
	if l<j then QS(l,j);
	if i<r then QS(i,r);
end;
begin
	assign(input,fi); reset(input);
	assign(output,fo); rewrite(output);
	readln(n);
	for i := 1 to n do read(a[i]);
	QS(1,n);
	for i:=n downto 3 do
		if a[i-2]+a[i-1]>a[i] then begin ok:=true; break; end;
	if ok then writeln('YES')  else writeln('NO');
	close(input); close(output);
end.

var a:array[1..100000] of int64;
    n,i:longint;

procedure qsort(l,r:longint);
var i,j:longint;
    q,w:int64;
begin
i:=l; j:=r;
q:=a[(l+r)div 2];
repeat
 while a[i] < q do inc(i);
 while q < a[j] do dec(j);
 if i<=j then
  begin
   w:=a[i]; a[i]:=a[j]; a[j]:=w;
   inc(i); dec(j);
  end;
until i>=j;
if l<j then qsort(l,j);
if r>i then qsort(i,r);
end;

begin
 readln(n);
 for i:=1 to n do
  read(a[i]);

 qsort(1,n);

 i:=3;

 while (a[i-1]+a[i-2] <= a[i]) and (i<=n) do inc(i);
 if i > n then writeln('NO')
          else writeln('YES');
end.

VAR n,i:longint;
    a:array[1..100000]of longint;
Procedure Qsort(l,r:longint);
 Var x,i,j,q:longint;
 Begin
  i:=l;
  j:=r;
  x:=a[(l+r)div 2];
  repeat
   while x>a[i] do inc(i);
   while x<a[j] do dec(j);
   if not(i>j)then begin
                    q:=a[i];
                    a[i]:=a[j];
                    a[j]:=q;
                    inc(i);
                    dec(j);
                   end;
  until i>j;
  if l<j then Qsort(l,j);
  if i<r then Qsort(i,r);
 End;
BEGIN
 read(n);
 for i:=1 to n do
  read(a[i]);
 Qsort(1,n);
 for i:=1 to n-2 do
  if(a[i]+a[i+1]>a[i+2])and(a[i]+a[i+2]>a[i+1])and(a[i+2]+a[i+1]>a[i])then begin write('YES');exit;end;
 write('NO');
END.

VAR n,i:longint;
    a:array[1..100000]of longint;
Procedure Qsort(l,r:longint);
 Var x,i,j,q:longint;
 Begin
  i:=l;
  j:=r;
  x:=a[(l+r)div 2];
  repeat
   while x>a[i] do inc(i);
   while x<a[j] do dec(j);
   if not(i>j)then begin
                    q:=a[i];
                    a[i]:=a[j];
                    a[j]:=q;
                    inc(i);
                    dec(j);
                   end;
  until i>j;
  if l<j then Qsort(l,j);
  if i<r then Qsort(i,r);
 End;
BEGIN
 read(n);
 for i:=1 to n do
  read(a[i]);
 Qsort(1,n);
 for i:=1 to n-2 do
  if a[i]+a[i+1]>a[i+2]then begin write('YES');exit;end;
 write('NO');
END.

var
 n,i,l,r,c,x: longint;
 a: array [0..111111] of longint;

 procedure qs(l,r: longint);
 var
  t,m,i,j: longint;
 begin
  i:=l;
  j:=r;
  m:=a[random(r-l+1)+l];
  repeat
   while a[i] < m do inc(i);
   while a[j] > m do dec(j);
   if i > j then break;
   t:=a[i]; a[i]:=a[j]; a[j]:=t;
   inc(i);
   dec(j);
  until i > j;
  if l < j then qs(l,j);
  if i < r then qs(i,r);
 end;

begin
 randomize;
 readln(n);
 for i:=1 to n do read(a[i]);
 qs(1,n);

 for i:=1 to n-2 do
 begin
  if (a[i]+a[i+1] > a[i+2]) and (a[i]+a[i+2] > a[i+1]) and (a[i+1]+a[i+2] > a[i]) then
  begin writeln('YES'); halt; end;
 end;

 writeln('NO');
end.

program ad;
var a: array [1..100000] of longint;
i,j,n,k,t: longint;

procedure stop(s: string);
begin
write(s);
halt;
end;

procedure check(a,b,c: longint);
begin
if (a+b>c) and (a+c>b) and (b+c>a) then stop('YES');
end;

procedure sort(m,t: longint);
var i,j,w,h: longint;
begin
i:=m;
j:=t;
w:= a[ random(t-m)+m ];
repeat
  while a[i]<w do inc(i);
  while a[j]>w do dec(j);
  if i<=j then
    begin
      h:=a[i];
      a[i]:=a[j];
      a[j]:=h;
      inc(i);
      dec(j);
    end;
until i>j;
if m<j then sort(m,j);
if i<t then sort(i,t);
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]);
sort(1,n);
for i:= 3 to n do
  check(a[i-2],a[i-1],a[i]);
stop('NO');
end.

var
 i,j,n,x,ans:longint;
 a,b:array[1..1000000]of int64;
procedure qs(l,r:longint);
 var
  i,j,t,mid:longint;
 begin
  i:=l;
  j:=r;
  mid:=a[(l+r) div 2];
  repeat
    while a[i]<mid do inc(i);
    while a[j]>mid do dec(j);
    if i<=j then begin
      t:=a[i]; a[i]:=a[j]; a[j]:=t;
      inc(i); dec(j);
    end;
  until i>j;
  if i<r then qs(i,r);
  if l<j then qs(l,j);
 end;
 function erfen(x:longint):longint;
 var l,r,m:longint;
 begin
   l:=0; r:=n+1;
   while l+1<r do begin
     m:=(l+r) div 2;
     if a[m]<x then l:=m
     else r:=m;
   end;
   exit(l);
 end;
begin
 readln(n);
 for i:=1 to n do
 read(a[i]);
 qs(1,n);
 for i:=1 to n-1 do
 for j:=i+1 to n do begin
   x:=a[i]+a[j];
   inc(ans,erfen(x)-j);
   if ans>0 then break;
 end;
  if ans>0 then writeln('YES')
  else writeln('NO');
end.

var
  a, b, c, i: longint;
  v: array [1..1000000] of int64;

procedure qSort(l, r: longint);
var
  i, j: longint;
  w, q: int64;
begin
  i := l;j := r;
  q := v[(l + r) div 2];
  repeat
    while (v[i] < q) do inc(i);
    while (q < v[j]) do dec(j);
    if (i <= j) then
    begin
      w := v[i];v[i] := v[j];v[j] := w;
      inc(i);dec(j);
    end;
  until (i > j);
  if (l < j) then qSort(l, j);
  if (i < r) then qSort(i, r);
end;

begin
  readln(a);
  for i := 1 to a do
  begin
    read(v[i]);
  end;
  Qsort(1, a);
  for i := a downto 3 do
  begin
    if (v[i] < v[i - 1] + v[i - 2]) then
      if (v[i - 1] < v[i] + v[i - 2]) then
        if (v[i - 2] < v[i] + v[i - 1] ) then
          inc(c);
  end;
  if (c > 0) then write('YES')
  else write('NO');
end.

var
  a: array [1..100000] of longint;

procedure swap(var a, b: longint);
var
  temp: longint;
begin
  temp := a;
  a := b;
  b := temp;
end;

procedure quicksort(l, r: longint);
var
  border, i: longint;
begin
  if l < r then begin
    swap(a[random(r - l + 1) + l], a[r]);
    border := l;
    for i := l to r - 1 do
      if (a[i] < a[r]) or ((a[i] = a[r]) and (random(2) = 1)) then begin
        swap(a[border], a[i]);
        inc(border);
      end;
    swap(a[border], a[r]);
    quicksort(l, border - 1);
    quicksort(border + 1, r);
  end;
end;

var
  n, i: longint;

begin
  read(n);
  for i := 1 to n do
    read(a[i]);

  quicksort(1, n);

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

var a:array[1..100002] of int64;
        n,i,j,m:longint;
        test:boolean;
     procedure sort(l,r:longint);
   var  g,f:longint;  mid,t:int64;
    begin
    g:=l;
    f:=r;
    if g>=f then exit;
    mid:=a[(l+r) div 2];
    while g<f do begin
    while a[g]<mid do inc(g);
    while a[f]>mid do dec(f);
   if g<=f then begin
   t:=a[g];
   a[g]:=a[f];
   a[f]:=t;
   inc(g);
   dec(f);
   end;
   end;
   sort(l,f);
   sort(g,r);
   end;

     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     sort(1,n);
     for i:=1 to n-2 do
      begin
   if (a[i]+a[i+1]>a[i+2])
   and (a[i]+a[i+2]>a[i+1])
   and (a[i+2]+a[i+1]>a[i])
   then begin
   test:=true;
   writeln('YES');
   break;
   end;
   end;
      if test=false then writeln('NO');

    end.

//a < b + c
//b < a + c
//c < a + b
//sort
//1 2 l
var
        n, i: longint;
        a: array [1..100005] of longint;

procedure sort(l,r: longint);
var
        i, j, x, y: longint;
begin
        i := l;
        j := r;
        x := a[(l + r) div 2];
        repeat
                while a[i] < x do
                        inc(i);
                while x < a[j] do
                        dec(j);
                if not (i > j) then
                begin
                        y := a[i];
                        a[i] := a[j];
                        a[j] := y;
                        inc(i);
                        j := j - 1;
                end;
         until i > j;
         if l < j then
                sort(l, j);
         if i < r then
                sort(i, r);
end;

var
        ta, tb, tc: longint;

function test(a, b, c: longint): boolean;
begin
        if (a + b <= c) or (a + c <= b) or (b + c <= a) then
                test := false
        else
                test := true;
end;

begin
        readln(n);
        for i := 1 to n do
                read(a[i]);
        sort(1, n);
        {for ta := 1 to n do
                for tb := ta + 1 to n do
                        for tc := n downto tb + 1 do
                                if test(a[ta], a[tb], a[tc]) then
                                begin
                                        writeln('YES');
                                        exit;
                                end;
        writeln('NO');//}
        //WP
        for i := n downto 3 do
        if test(a[i], a[i - 1], a[i - 2]) then
        begin
                writeln('YES');
                exit;
        end;
        writeln('NO');
        //}
end.

var
n:longint;
i:integer;
a:array [1..100001] of longint;

function pr(p,l:longint):longint;
var i,j,t,x:longint;
begin
i:=p-1;j:=l+1;x:=a[p];
while i<j do begin
repeat i:=i+1 until x<=a[i];
repeat j:=j-1; until x>=a[j];
if i<j then  begin
t:=a[j];a[j]:=a[i];a[i]:=t;
end;end;
pr:=j;
end;

procedure qs(p,l:longint);
var q:longint;
begin
if p<l then begin
q:=pr(p,l);
qs(p,q);
qs(q+1,l);
end;
end;

begin
read(n);
for i:=1 to n do read(a[i]);

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

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

procedure sort(l,r:longint);
    var i,j,m,k,t:longint;
        begin
            i:=l;
            j:=r;
            m:=random(r-l)+l+1;
            k:=a[m];
            repeat
                while k>a[i] do inc(i);
                while k<a[j] do dec(j);
                if not(i>j) then
                    begin
                        t:=a[i];
                        a[i]:=a[j];
                        a[j]:=t;
                        inc(i);
                        dec(j);
                    end;
            until i>j;
                if l<j then sort(l,j);
                if i<r then sort(i,r);
        end;

procedure xuli;
    begin
        readln(n);
        for i:=1 to n do
            read(a[i]);
        sort(1,n);
        For i:=1 to n-2 do
            begin
                if a[i]+a[i+1]>a[i+2] then
                    begin
                        writeln('YES');
                        halt;
                    end;
            end;
        writeln('NO');
    end;

begin
//assign(input,'b.inp');reset(input);
//assign(output,'b.out');rewrite(output);
xuli;
end.

var n,m,z,i,summ:longint; mass:array[0..1000000] of integer;

procedure qSort(l,r:longint);
var i,j:longint;
     w,q:int64;
begin
   i := l; j := r;
   q := mass[(l+r) div 2];
   repeat
     while (mass[i] < q) do inc(i);
     while (q < mass[j]) do dec(j);
     if (i <= j) then
     begin
       w:=mass[i]; mass[i]:=mass[j]; mass[j]:=w;
       inc(i); dec(j);
     end;
   until (i > j);
   if (l < j) then qSort(l,j);
   if (i < r) then qSort(i,r);
end;

begin

read(n);

for i:=1 to n do
begin
    read(mass[i]);
end;

qsort(1,n);

for i:= n downto 3 do
begin
    if(mass[i]+mass[i-1] > mass[i-2]) and (mass[i-2]+mass[i-1] > mass[i]) and (mass[i]+mass[i-2] > mass[i-1]) then
    begin
        write('YES');
        exit;
    end;
end;

write('NO');

end.

uses
  SysUtils;

var
  n, i: integer;
  a: array [0..1000000] of integer;

function min(a, b: int64): int64;
begin
  if (a > b) then min := b else min := a;
end;

function max(a, b: int64): int64;
begin
  if (a > b) then max := a else max := b;
end;

procedure qsort( min, max: Integer);
var
  i, j : integer;
  sd, t: integer;
begin
  sd:=a[max-((max-min) div 2)];
  i:=min; j:=max;
  while i<j do
  begin
    while a[i] < sd do i:=i+1;
    while a[j] > sd do j:=j-1;
    if i<=j then
      begin
        t:=a[i]; a[i]:=a[j]; a[j]:=t;
        i:=i+1; j:=j-1;
      end;
  end;
  if min<j then qsort(min, j);
  if i<max then qsort(i, max);
end;

begin
   readln(n);
   for i := 1 to n do read(a[i]);
   qsort(0, n);
   for i := 1 to n do
     if(a[i - 1] >= (a[i] div 2 + 1)) and (i >= 3) then
     begin
       writeln('YES');
       halt(0);
     end;
   writeln('NO');
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g:integer;
   a: array [0..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   for i := 3 to n do
       if (a[i] + a[i - 1] >= a[i - 2]) and (a[i - 1] + a[i - 2] >= a[i]) and (a[i] + a[i - 2] >= a[i - 1]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
   if (g = 0) then
     writeln('NO');
   readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g:integer;
   a: array [2..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   for i := 1 to n do
       if (a[i] + a[i + 1] >= a[i + 2]) and (a[i + 1] + a[i + 2] >= a[i]) and (a[i] + a[i + 2] >= a[i + 1]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
   if (g = 0) then
     writeln('NO');
   readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g, f:integer;
   a: array [0..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   for i := 1 to n do begin
     f := a[i];
     for j := i + 1 to n do
       if (f + a[j + 1] > a[j]) and (a[j] + a[j + 1] > f) and (f + a[j] > a[j + 1]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
     if (g = 1) then
      break;
   end;
   if (g = 0) then
     writeln('NO');
   readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g:integer;
   a: array [2..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   for i := 3 to n do
       if (a[i] + a[i - 1] >= a[i - 2]) and (a[i - 1] + a[i - 2] >= a[i]) and (a[i] + a[i - 2] >= a[i - 1]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
   if (g = 0) then
     writeln('NO');
   readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g:integer;
   a: array [0..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   for i := 3 to n do
       if (a[i] + a[i - 1] > a[i - 2]) and (a[i - 1] + a[i - 2] > a[i]) and (a[i] + a[i - 2] > a[i - 1]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
   if (g = 0) then
     writeln('NO');
   readln;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, n, g, f:integer;
   a: array [0..100000] of integer;
begin
   readln(n);
   for i := 1 to n do
     read(a[i]);
   g := 0;
   for i := 1 to n do begin
     f := a[i];
     for j := i + 1 to n do
       if (f + a[j + 1] > a[j]) and (a[j] + a[j + 1] > f) and (f + a[j + 1] > a[j]) then begin
         writeln('YES');
         g := 1;
         break;
       end;
     if (g = 1) then
      break;
   end;
   if (g = 0) then
     writeln('NO');
   readln;
end.

program otrezki;
var
n,i: int64;
first,last,start,final,j,min,y,z: int64;
a,b: array[1..100001] of int64;
procedure Merge(first,last: int64);
  var
  i: int64;
  begin
  start:=first;
  final:=(first+last) div 2+1;
  for i:=first to last do
    begin
    if (start <= (first+last) div 2) and ((final > last) or (a[start] < a[final])) then
      begin
      b[i]:=a[start];
      inc(start);
      end else
      begin
      b[i]:=a[final];
      inc(final);
      end;
    end;
  for i:=first to last do a[i]:=b[i];
  end;

procedure MergeSort(first, last: int64);
  begin
  if first < last then
  begin
  MergeSort(first,(first+last) div 2);
  MergeSort((first+last) div 2+1,last);
  Merge(first, last);
  end;
  end;
procedure FindLowestTriangle;
  begin
  i:=1;
  j:=3;
  min:=10000000000;
  while j<=N do
   begin
   if a[j] - a[i] <= min then
    begin
    min:=a[j] - a[i];
    y:=i;
    z:=j;
    end;
   inc(i);
   inc(j);
   end;
  end;
begin
read(n);
for i:=1 to N do
  read(a[i]);
MergeSort(1,N);
FindLowestTriangle;
if (a[y]+a[y+1] > a[z]) and (a[z]+ a[y] > a[y+1]) and (a[z] + a[y+1] > a[y]) then
 write('YES') else write('NO');
end.

var a:array[1..100010] of longint;
i,j,n:longint;
b,c,d:int64;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

begin
  readln(n);
  for i:=1 to n do
   read(a[i]);

  sort(1,n);

  for i:=n downto 3 do
   begin
    b:=a[i];
    c:=a[i-1];
    d:=a[i-2];
    if (c+d>=b) then begin
                       writeln('YES');
                       halt;
                     end;
   end;
  writeln('NO');
end.

var a:array[1..100010] of longint;
i,j,n,b,c,d:longint;

procedure sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

begin
  readln(n);
  for i:=1 to n do
   read(a[i]);

  sort(1,n);

  for i:=2 to n-1 do
   begin
    b:=a[i-1];
    c:=a[i];
    d:=a[i+1];
    if (b+c>=d) and (c+d>=b) and (b+d>=c) then begin
                                                writeln('YES');
                                                halt;
                                               end;
   end;
  writeln('NO');
end.

Program CodeF_396_B;
var mas:array[1..100000]of int64;
    i,n,t:longint;
procedure swap(var a,b:int64);
var c:int64;
begin
  c:=a;
  a:=b;
  b:=c;
end;

Procedure q_sort2(a,b:longint);
var p,i,j:longint;
    q:int64;
begin
if b-a>1 then
  begin
    p:=random(b-a+1)+a;
    q:=mas[p];
    swap(mas[p], mas[a]);
    i:=a+1;
    j:=b;
      while i<j do
        begin
          while (mas[i]<=q) and (i<b) do inc(i);
          while mas[j]>q  do dec(j);
          if i<j then swap(mas[i], mas[j]);
        end;
    swap(mas[a], mas[j]);
    q_sort2(a, j-1);
    q_sort2(j+1, b);
  end                 else
    if (b-a=1) and (mas[a]>mas[b]) then swap(mas[a],mas[b]);

end;

begin
read(n);
for i:=1 to n do
  read(mas[i]);
for i:=1 to n-2 do
  if (mas[i+2]<mas[i]+mas[i+1]) and (t=0) then t:=1;
if t=0 then q_sort2(1,n);

for i:=1 to n-2 do
  if (mas[i+2]<mas[i]+mas[i+1]) and (t=0) then t:=1;
if t=1 then write('Yes') else write('No');

end.

var i,n: longint;
    a: array[1..100000] of longint;
procedure qsort(l,r: longint);
var i,j,m,t,x: longint;
begin
    i:=l;
    j:=r;
    m:=(l+r) div 2;
    x:=a[m];
    while (i<=j) do
    begin
        while (a[i]<x) do inc(i);
        while (a[j]>x) do dec(j);
        if i<=j then
        begin
            t:=a[i];
            a[i]:=a[j];
            a[j]:=t;
            inc(i);
            dec(j);
        end;
    end;
    if (l<j) then qsort(l,j);
    if (i<r) then qsort(i,r);
end;
begin
    readln(n);
    for i:=1 to n do read(a[i]);
    qsort(1,n);
    if (a[1]+a[2])>=a[n] then write('NO') else write('YES');
end.

var i,n: longint;
    a: array[1..100000] of longint;
procedure qsort(l,r: longint);
var i,j,m,t,x: longint;
begin
    i:=l;
    j:=r;
    m:=(l+r) div 2;
    x:=a[m];
    while (i<=j) do
    begin
        while (a[i]<x) do inc(i);
        while (a[j]>x) do dec(j);
        if i<=j then
        begin
            t:=a[i];
            a[i]:=a[j];
            a[j]:=t;
            inc(i);
            dec(j);
        end;
    end;
    if (l<j) then qsort(l,j);
    if (i<r) then qsort(i,r);
end;
begin
    readln(n);
    for i:=1 to n do read(a[i]);
    qsort(1,n);
    for i:=2 to n-1 do
        if (a[i-1]+a[i])>a[i+1] then write('YES') else write('NO');
end.

Const fi='';
      fo='';
Var  n:longint;
    a:array[-10..100000] of longint;
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 sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

Procedure xuly;
    Var i,j,k:longint;
    begin
        sort(1,n);
        i:=n; j:=n; k:=n;
        While i>0 do
            begin
                i:=i-3; j:=j-2; k:=k-1;
                if (a[i] + a[k]>a[j]) and (abs(a[i]-a[k])<a[j]) then
                    begin
                        Write('YES');
                        exit;
                    end;

            end;
         Write('NO');
    end;

BEGIN
    assign(output,fo); rewrite(output);
    nhap;
    xuly;
    Close(output);
END.

Const fi='';
      fo='';
Var  n:longint;
    a:array[-10..100000] of longint;
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 sort(l,r: longint);
      var
         i,j,x,y: longint;
      begin
         i:=l;
         j:=r;
         x:=a[(l+r) div 2];
         repeat
           while a[i]<x do
            inc(i);
           while x<a[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

Procedure xuly;
    Var i,j,k:longint;
    begin
        sort(1,n);
        i:=n; j:=n; k:=n;
        While i>0 do
            begin
                i:=i-3; j:=j-2; k:=k-1;
                if (a[i] + a[k]>a[j]) and (abs(a[i]-a[k])<a[j]) and (a[i]+a[j]>a[k]) and (a[j]+a[k]>a[i]) and (a[j]-a[k]<a[i]) and (a[i]-a[j]<a[k]) then
                    begin
                        Write('YES');
                        exit;
                    end;

            end;
         Write('NO');
    end;

BEGIN
    assign(output,fo); rewrite(output);
    nhap;
    xuly;
    Close(output);
END.

var a:array [1..10001] of longint;i,j,k,s,n:longint;
procedure sort(l,r:longint);
var m,i,j,x1:longint;
begin
 i:=l;
 j:=r;
 m:= round ((l+r)/2);
 x1:=a[m];
 repeat
  while a[i]<x1 do inc(i);
  while a[j]>x1 do dec(j);
 if i<=j then
 m:=a[i];
 a[i]:=a[j];
 a[j]:=m;
 inc(i);
 dec(j);
 until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
sort(1,n);
i:=1;
j:=2;
k:=3;
while (s<>1) and (k<=n) do begin
if a[i]+a[j]>a[k] then
s:=1
else
 begin
 i:=i+1;
 j:=j+1;
 k:=k+1;
 end;
end;
if s=1 then
writeln('YES')
else
writeln('NO');
end.

var a:array [1..10001] of longint;i,j,k,s,n:longint;
procedure sort(l,r:longint);
var m,i,j,x1:longint;
begin
 i:=l;
 j:=r;
 m:= round ((l+r)/2);
 x1:=a[m];
 repeat
  while a[i]<x1 do inc(i);
  while a[j]>x1 do dec(j);
 if i<=j then
 m:=a[i];
 a[i]:=a[j];
 a[j]:=m;
 inc(i);
 dec(j);
 until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
sort(1,n);
i:=1;
j:=2;
k:=3;
while (s<>1) and (k<=n) do begin
if a[i]+a[j]>a[k] then
s:=1
else
 begin
 if (i+1=j) and (j+1=k) then
 k:=k+1;
 if i+1=j then
  j:=j+1
 else
  i:=i+1
 end;
end;
if s=1 then
writeln('YES')
else
writeln('NO');
end.

type
  mass=array[1..1000]of longint;
var
  a:mass;
  i,n,j,q:longint;
test:boolean;
begin
readln(n);
for i:=1 to n do
  read(a[i]);
test:=false;
if n>14 then
begin
for i:=1 to n-2 do
  begin
  if test=true then break;
  for j:=i+1 to n-1 do
    begin
    if test=true then break;
    for q:=j+1 to n do
        if (a[i]<a[j]+a[q]) and (a[q]<a[i]+a[j]) and (a[j]<a[i]+a[q]) then
                                                                    begin
                                                                    test:=true;
                                                                    writeln('YES');
                                                                    break;
                                                                    end;
    end;
  end;
if test=false then writeln('NO');
end
  else writeln('NO');
end.

type
  mass=array[1..1000]of longint;
var
  a:mass;
  i,n:longint;
  test:boolean;
function corp(r,b:longint):boolean;
begin
if r>b then corp:=true
       else corp:=false;
end;
procedure sort ( first, last: integer);
   var L, R, c, X: integer;
   begin
      if first < last then
      begin
         X:= A[(first + last) div 2];
         L:= first;
         R:= last;
            while L <= R do
            begin
               while A[L] < X do
                  L:= L + 1;
               while A[R] > X do
                  R:= R - 1;
               if L <= R then
               begin
                  c:= A[L];
                  A[L]:= A[R];
                  A[R]:= c;
                  L:= L + 1;
                  R:= R - 1;
               end;
           end;
        sort(first, R);
        sort(L, last);
     end;
  end;

begin
readln(n);
for i:=1 to n do
  read(a[i]);
test:=false;
sort(1,n);
for i:=1 to (n-2) do
  if a[i]<a[i+1]+a[i+2] then begin
                             test:=true;
                             writeln('YES');
                             break;
                             end;
if test=false then writeln('NO');
end.

type
  mass=array[1..1000]of longint;
var
  a:mass;
  i,n,j,q:longint;
test:boolean;
begin
readln(n);
for i:=1 to n do
  read(a[i]);
test:=false;
if n<=10 then
begin
for i:=1 to n-2 do
  begin
  if test=true then break;
  for j:=i+1 to n-1 do
    begin
    if test=true then break;
    for q:=j+1 to n do
        if (a[i]<a[j]+a[q]) and (a[q]<a[i]+a[j]) and (a[j]<a[i]+a[q]) then
                                                                    begin
                                                                    test:=true;
                                                                    writeln('YES');
                                                                    break;
                                                                    end;
    end;
  end;
if test=false then writeln('NO');
end
  else writeln('YES');
end.

var n,i:longint;
a:array[1..100000]of longint;
procedure Qsort(first,last:longint);
        var L,R,Temp,X:longint;
        begin
        if first<last then
                begin
                L:=first;
                R:=last;
                x:=a[(first+last) div 2];
                while L<=R do
                        begin
                        while a[l]<x do
                                inc(l);
                        while a[r]>x do
                                dec(r);
                        If l<=r then
                                begin
                                temp:=a[l];
                                a[l]:=a[r];
                                a[r]:=temp;
                                inc(l);
                                dec(r);
                                end;
                        end;
                Qsort(First,R);
                Qsort(L,Last);
                end;
        end;
begin
readln(n);
for i:=1 to n do
        read(a[i]);
for i:=1 to n-2 do
        if a[i]<a[i+1]+a[i+2] then
                begin
                write('YES');
                halt;
                end;
write('NO');
end.

var
 i,j,n,k,l:longint;
 a:array[1..100000] of longint;
procedure qs(ip,ik:longint);
var
 i,y,r:longint;
begin
 y:=ip;
  for i:=ip+1 to ik do
   begin
    if a[i]<a[y] then
     begin
      r:=a[y]; a[y]:=a[y+1]; a[y+1]:=a[y]; inc(y);
       if i<>y then
        begin
         r:=a[i]; a[i]:=a[y-1]; a[y-1]:=r;
        end;
       end;
      end;
  if y-ip>1 then qs(ip,y-1);
  if ik-y>1 then qs(y+1,ik);
end;
begin
 readln(n);
 for i:=1 to n do
  read(a[i]);
  qs(1,n);
   for i:=2 to n-1 do
    begin
     if a[i]+a[i-1]>a[i+1] then begin writeln('YES'); exit; end;
    end;
  writeln('NO');

end.

var
 i,j,n,k,l:longint;
 a:array[1..100005] of longint;
procedure qs(ip,ik:longint);
var
 i,y,r:longint;
 p:boolean;
begin
 y:=ip;
  for i:=ip+1 to ik do
   begin
    if a[i]<a[y] then
     begin
     // p:=true;
      r:=a[y]; a[y]:=a[y+1]; a[y+1]:=r; inc(y);
       if i<>y then
        begin
         r:=a[i]; a[i]:=a[y-1]; a[y-1]:=r;
        end;
       end;
      end;
  if y-ip>1 then qs(ip+1,y-1);
  if ik-y>1 then qs(y+1,ik-1);
end;
begin
 readln(n);
 for i:=1 to n do
  read(a[i]);
  qs(1,n);
   for i:=2 to n-1 do
    begin
     if a[i]+a[i-1]>a[i+1] then begin writeln('YES'); exit; end;
    end;
  writeln('NO');

end.

var
 i,j,n,k,l:longint;
 a:array[1..100000] of longint;
procedure qs(ip,ik:longint);
var
 i,y,r:longint;
begin
 y:=ip;
  for i:=ip+1 to ik do
   begin
    if a[i]<a[y] then
     begin
      r:=a[y]; a[y]:=a[y+1]; a[y+1]:=r; inc(y);
       if i<>y then
        begin
         r:=a[i]; a[i]:=a[y-1]; a[y-1]:=r;
        end;
       end;
      end;
  if y-ip>1 then qs(ip,y-1);
  if ik-y>1 then qs(y+1,ik);
end;
begin
 readln(n);
 for i:=1 to n do
  read(a[i]);
  qs(1,n);
  for i:=1 to n do
   write(a[i],' ');
   writeln;
   for i:=2 to n-1 do
    begin
     if a[i]+a[i-1]>a[i+1] then begin writeln('YES'); {writeln(i); }exit; end;
    end;
  writeln('NO');

end.

var
   n,i,j,s : integer;
   n1 : array of integer;

procedure qsort(l, r: longint);
var
  i, j, x, y: longint;
begin
  randomize;
  i := l;
  j := r;
  x := n1[random(r - l + 1) + l];
  repeat
    while(n1[i] < x) do inc(i);
    while(n1[j] > x) do dec(j);
    if(i <= j) then
    begin
      y := n1[i];
      n1[i] := n1[j];
      n1[j] := y;
    end;
    i:=i+1; j:=j-1;
  until (i > j);
  if(l < j) then qsort(l, j);
  if(i < r) then qsort(i, r);
end;

begin
     randomize;
     readln(n);
     SetLength(n1,n);
     for i  := 0 to n-1 do
     begin
         read(n1[i]);
     end;
     qsort(0,n-1);
     for i := 0 to n-3 do
     begin
          if n1[i] + n1[i+1] > n1[i+2] then
          begin
          writeln('YES');
          exit;
          end;
     end;
     writeln('NO');
end.

var
   n,i,j,s : integer;
   n1 : array of integer;

procedure qsort(l, r: longint);
var
  i, j, x, y: longint;
begin
  randomize;
  i := l;
  j := r;
  x := n1[random(r - l + 1) + l];
  repeat
    while(n1[i] < x) do inc(i);
    while(n1[j] > x) do dec(j);
    if(i <= j) then
    begin
      y := n1[i];
      n1[i] := n1[j];
      n1[j] := y;
      i:=i+1; j:=j-1;
    end;

  until (i > j);
  if(l < j) then qsort(l, j);
  if(i < r) then qsort(i, r);
end;

begin
     randomize;
     readln(n);
     SetLength(n1,n);
     for i  := 0 to n-1 do
     begin
         read(n1[i]);
     end;

     qsort(0,n-1);

     for i  := 0 to n-1 do
     begin
         write(n1[i],' ');
     end;
     for i := 0 to n-3 do
     begin
          if (n1[i] + n1[i+1]) > n1[i+2] then
          begin
          writeln('YES');
          exit;
          end;
     end;
     writeln('NO');
end.

uses math;
const
	fi = '';
	fo = '';
	maxn = 100001;
var	a:array[0..maxn] of longint;
	n,i:longint;
procedure QS(l,r:longint);
var i,j,x,t:longint;
begin
	i:=l; j:=r; x:=a[(l+r) div 2];
	repeat
		while a[i]<x do i:=i+1;
		while x<a[j] do j:=j-1;
		if i<=j then
		begin
			t:=a[i]; a[i]:=a[j]; a[j]:=t;
			i:=i+1; j:=j-1;
		end;
	until i>j;
	if l<j then QS(l,j);
	if i<r then QS(i,r);
end;
begin
	assign(input,fi); reset(input);
	assign(output,fo); rewrite(output);
	readln(n);
	for i := 1 to n do read(a[i]);
	QS(1,n);
	if a[n-2]+a[n-1]>a[n] then writeln('YES') else writeln('NO');
	close(input); close(output);
end.

var a:array[1..100000] of int64;
    n,i:longint;

procedure qsort(l,r:longint);
var i,j:longint;
    q,w:int64;
begin
i:=l; j:=r;
q:=a[(l+r)div 2];
repeat
 while a[i] < q do inc(i);
 while q < a[j] do dec(j);
 if i<=j then
  begin
   w:=a[i]; a[i]:=a[j]; a[j]:=w;
   inc(i); dec(j);
  end;
until i>=j;
if l<j then qsort(l,j);
if r>i then qsort(i,r);
end;

begin
 readln(n);
 for i:=1 to n do
  read(a[i]);

 qsort(1,n);

 i:=3;

 while (a[i-1]+a[i-2] < a[i]) and (i<=n) do inc(i);
 if i > n then writeln('NO')
          else writeln('YES');
end.

var
 n,i,l,r,c,x: longint;
 a: array [0..111111] of longint;

 procedure qs(l,r: longint);
 var
  t,m,i,j: longint;
 begin
  i:=l;
  j:=r;
  m:=a[random(r-l+1)+l];
  repeat
   while a[i] < m do inc(i);
   while a[j] > m do dec(j);
   if i > j then break;
   t:=a[i]; a[i]:=a[j]; a[j]:=t;
   inc(i);
   dec(j);
  until i > j;
  if l < j then qs(l,j);
  if i < r then qs(i,r);
 end;

begin
 readln(n);
 for i:=1 to n do read(a[i]);
 qs(1,n);

 for i:=1 to n-1 do
 begin
  l:=1;
  r:=i-1;
  if l > r then continue;
  x:=a[n]+a[i]-1;
  while l < r do
  begin
   c:=(l+r) div 2;
   if a[c] >= x then r:=c else l:=c+1;
  end;

  if (a[n]+a[i] > a[l]) and (a[n]+a[l] > a[i]) and (a[l]+a[i] > a[n]) then
  begin writeln('YES'); halt; end;

  l:=i+1;
  r:=n-1;
  if l > r then continue;
  x:=a[n]+a[i]-1;
  while l < r do
  begin
   c:=(l+r) div 2;
   if a[c] >= x then r:=c else l:=c+1;
  end;

  if (a[n]+a[i] > a[l]) and (a[n]+a[l] > a[i]) and (a[l]+a[i] > a[n]) then
  begin writeln('YES'); halt; end;
 end;

 writeln('NO');
end.

    var a:array[1..100010] of int64;
        n,i,j,m:longint;
        test:boolean;
     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     for i:=1 to n do
      begin
      j:=i+2;
      while j<=n do
        begin
      if ((a[i]+a[j]>=a[j-1]) and (a[i]+a[j-1]>=a[j]) and (a[j]+a[j-1]>=a[i])) and (abs(a[i]-a[j-1])<=a[j]) then
       begin
       Writeln('YES');
       test:=true;
       break;
       end;
       inc(j);
        end;
        if test=true then break;
      end;
      if test=false then writeln('NO');
    end.

   var a:array[1..100010] of int64;
        n,i,j,m:longint;
        test:boolean;
     procedure sort(l,r:longint);
   var  g,f:longint;  mid,t:int64;
    begin
    g:=l;
    f:=r;
    if g>=f then exit;
    mid:=a[(l+r) div 2];
    while a[g]<mid do inc(g);
    while a[f]>mid do dec(f);
   if g<=f then begin
   t:=a[g];
   a[g]:=a[f];
   a[f]:=t;
   inc(g);
   dec(f);
   end;
   sort(l,f);
   sort(g,r);
   end;

     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     sort(1,n);
     for i:=2 to n-1 do
      begin
   if (a[i]+a[i-1]>a[i+2])
   and (a[i]+a[i+2]>a[i-1])
   and (a[i+2]+a[i-1]>a[i])
   then begin
   test:=true;
   writeln('YES');
   break;
   end;
   end;
      if test=false then writeln('NO');
    end.

  var a:array[1..100010] of int64;
        n,i,j,m:longint;
        test:boolean;
     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     for i:=1 to n-2 do
      begin
      j:=i+2;
      while j<=n do
        begin
      if ((a[i]+a[j]>=a[j-1]) and (a[i]+a[j-1]>=a[j]) and (a[j]+a[j-1]>=a[i])) and (abs(a[i]-a[j-1])<=a[j]) then
       begin
       Writeln('YES');
       test:=true;
       break;
       end;
       inc(j);
        end;
        if test=true then break;
      end;
      if test=false then writeln('NO');
    end.

  var a:array[1..100010] of int64;
        n,i,j,m:longint;
        test:boolean;
     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     for i:=1 to n do
      begin
      j:=i+2;
      while j<=n do
        begin
      if (a[i]+a[j]>=a[j-1]) and (a[i]+a[j-1]>=a[j]) and (a[j]+a[j-1]>=a[i]) then
       begin
       Writeln('YES');
       test:=true;
       break;
       end;
       inc(j);
        end;
        if test=true then break;
      end;
      if test=false then writeln('NO');
    end.

var a:array[1..100010] of int64;
        n,i,j,m:longint;
        test:boolean;
     procedure sort(l,r:longint);
   var  g,f:longint;  mid,t:int64;
    begin
    g:=l;
    f:=r;
    if g>=f then exit;
    mid:=a[(l+r) div 2];
    while a[g]<mid do inc(g);
    while a[f]>mid do dec(f);
   if g<=f then begin
   t:=a[g];
   a[g]:=a[f];
   a[f]:=t;
   inc(g);
   dec(f);
   end;
   sort(l,f);
   sort(g,r);
   end;

     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     sort(1,n);
     for i:=1 to n-2 do
      begin
      j:=i+2;
      while j<=n do
        begin
      if ((a[i]+a[j]>=a[j-1]) and (a[i]+a[j-1]>=a[j]) and (a[j]+a[j-1]>=a[i])) and (abs(a[i]-a[j-1])<=a[j]) then
       begin
       Writeln('YES');
       test:=true;
       break;
       end;
       inc(j);
        end;
        if test=true then break;
      end;
      if test=false then writeln('NO');
    end.

 var a:array[1..100010] of int64;
        n,i,j,m:longint;
        test:boolean;
     begin
     test:=false;
     readln(n);
     for i:=1 to n do read(a[i]);
     for i:=1 to n do
      begin
      j:=i+2;
      while j<=n do
        begin
      if (a[i]+a[j]>a[j-1]) and (a[i]+a[j-1]>a[j]) and (a[j]+a[j-1]>a[i]) then
       begin
       Writeln('YES');
       test:=true;
       break;
       end;
       inc(j);
        end;
        if test=true then break;
      end;
      if test=false then writeln('NO');
    end.

var
        a, b: ansistring;

begin
        readln(a);
        read(b);
        if a = b then
        begin
                writeln(-1);
                exit;
        end;
        if length(a) > length(b) then
                writeln(length(a))
        else
        if length(b) > length(a) then
                writeln(length(b))
        else
        begin
            writeln(length(a));
        end;
end.

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

procedure sort(l,r:longint);
    var i,j,m,k,t:longint;
        begin
            i:=l;
            j:=r;
            m:=random(r-l)+l+1;
            k:=a[m];
            repeat
                while k>a[i] do inc(i);
                while k<a[j] do dec(j);
                if not(i>j) then
                    begin
                        t:=a[i];
                        a[i]:=a[j];
                        a[j]:=t;
                        inc(i);
                        dec(j);
                    end;
            until i>j;
                if l<j then sort(l,j);
                if i<r then sort(i,r);
        end;

procedure xuli;
    begin
        readln(n);
        for i:=1 to n do
            read(a[i]);
        sort(1,n);
        if (a[n-2]+a[n-1]>a[n]) and (a[n]-a[n-1]<a[n-2]) then
            writeln('YES') else writeln('NO');
    end;

begin
//assign(input,'b.inp');reset(input);
//assign(output,'b.out');rewrite(output);
xuli;
end.

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

procedure sort(l,r:longint);
    var i,j,m,k,t:longint;
        begin
            i:=l;
            j:=r;
            m:=random(r-l)+l+1;
            k:=a[m];
            repeat
                while k>a[i] do inc(i);
                while k<a[j] do dec(j);
                if not(i>j) then
                    begin
                        t:=a[i];
                        a[i]:=a[j];
                        a[j]:=t;
                        inc(i);
                        dec(j);
                    end;
            until i>j;
                if l<j then sort(l,j);
                if i<r then sort(i,r);
        end;

procedure xuli;
    begin
        readln(n);
        for i:=1 to n do
            read(a[i]);
        sort(1,n);
        if (a[n-2]+a[n-1]>a[n]) and (a[n-1]-a[n-2]<a[n]) then
            writeln('YES') else writeln('NO');
    end;

begin
//assign(input,'b.inp');reset(input);
//assign(output,'b.out');rewrite(output);
xuli;
end.