uses
  testlib, sysutils;

function ending(x: longint): string;
begin
  x := x mod 100;
  if x div 10 = 1 then
    ending := 'th'
  else
    case x mod 10 of
      1: ending := 'st';
      2: ending := 'nd';
      3: ending := 'rd';
      else
        ending := 'th';
    end;
end;

var
  n, k, t, sumsq, sum: int64;
  ja, pa: string; 
  a: array[0..1000000] of byte;      

// inf - input
// ouf - ответ участника
// ans - ответ жюри
begin
  n := 0;
  ja := uppercase(ans.readstring);
  pa := uppercase(ouf.readstring);

  if (pa <> 'YES') and (pa <> 'NO') then
     quit(_pe, '"YES" or "NO" expected, "' + pa + '" found');
  
  if ja <> pa then
     quit(_wa, 'expected: ' + ja + ', found: ' + pa);

  
  if (pa = 'YES') then
    begin
      n := inf.readlongint;
      n := n - 1;
      fillchar(a, sizeof(a), 0);
      while not ouf.seekeof do
        begin
    	  t := ouf.readlongint;
          if (t < 0) or (t > n) then quit(_wa, 'Found incorrect number');
    	  inc(a[t]);
	  if (a[t] > 1) then quit(_wa, 'Incorrect sequence');
	  sum := sum + t;
	  sumsq := sumsq + t * t;		
        end;
      if (sum * 4 <> n * (n + 1)) then
	quit(_wa, 'Incorrect sum. Expected: ' + inttostr(n * (n + 1) div 4) + ' found: ' + inttostr(sum));
      if (sumsq * 12 <> n * (n + 1) * (2 * n + 1)) then
	quit(_wa, 'Incorrect sum square');
    end;
  quit(_ok, 'Ok');
end.
