const
  maxn = 300000;
var
  a, max, min : array[1..maxn] of integer;
  n, i, ans : integer;
begin
  assign(input, 'cubics.in');
  assign(output, 'cubics.out');
  reset(input);
  rewrite(output);
  read(n);
  for i := 1 to n do begin
    read(a[i]);
    max[i] := a[i];
    if ((i > 1) and (max[i] < max[i - 1])) then begin
      max[i] := max[i - 1];
    end;
  end;
  ans := 0;
  for i := n downto 1 do begin
    min[i] := a[i];
    if ((i < n) and (min[i] > min[i + 1])) then begin
      min[i] := min[i + 1];
    end;
    if (i < n) and (min[i + 1] > max[i]) then begin
      ans := ans + 1;
    end;
  end;
  writeln(ans);
  for i := 1 to n - 1 do begin
    if (max[i] < min[i + 1]) then
      write(i, ' ');
  end;
end.
