uses
  testlib, SysUtils;

const
  MAX = 100000;

var
  a, b : array[1..MAX] of integer;
  i, n, code : integer;
  sk : string;
  k, t : int64;
  used : array[1..MAX] of boolean;

function merge(l, r : integer) : int64;
var
  i, j, k, m : integer;
  res : int64;
begin
  if (l >= r) then begin
    merge := 0;
    exit;
  end;
  m := (l + r) div 2;
  res := merge(l, m) + merge(m + 1, r);
  i := l;
  j := m + 1;
  k := 1;
  while (i <= m) or (j <= r) do begin
    if (j > r) or ((i <= m) and (a[i] < a[j])) then begin
      b[k] := a[i];
      i := i + 1;
      k := k + 1;
    end else begin
      b[k] := a[j];
      j := j + 1;
      k := k + 1;
      res := res + m - i + 1;
    end;
  end;
  for j := 1 to k - 1 do begin
    a[l + j - 1] := b[j];
  end;
  merge := res;
end;

begin
  n := inf.readlongint;
  sk := inf.readword(blanks, blanks);
  val(sk, k, code);
  for i := 1 to n do begin
    a[i] := ouf.readlongint;
    if (a[i] < 1) or (a[i] > n) then
      quit(_wa, 'Wrong number: ' + IntToStr(a[i]));
    if (used[a[i]]) then
      quit(_wa, 'Duplicate number: ' + IntToStr(a[i]));
    used[a[i]] := true;
  end;
  t := merge(1, n);
  if (t <> k) then
    quit(_wa, 'Wrong number of inversions');
  quit(_ok, 'OK');
end.