// A set type that can be used to represent a bitset
program BitsetExample;
type
  TBitset = set of 0..31;  // Define a bitset with 32 bits
var
  bitset: TBitset;
// Function to print the bitset as 0 and 1 in reverse order
procedure PrintBitset(bits: TBitset);
var
  i: Integer;
begin
  for i := 31 downto 0 do  // Iterate in reverse order
  begin
    if i in bits then
      Write('1')
    else
      Write('0');
  end;
  WriteLn;
end;
begin
  bitset := [];  // Initialize the bitset to be empty
  // Set some bits
  Include(bitset, 1);
  Include(bitset, 3);
  Include(bitset, 5);
  // Print the bitset
  WriteLn('Bitset:');
  PrintBitset(bitset);
  // Clear a bit
  Exclude(bitset, 3);
  // Print the modified bitset
  WriteLn('Bitset after clearing bit 3:');
  PrintBitset(bitset);
end.
(*
run:
Bitset:
00000000000000000000000000101010
Bitset after clearing bit 3:
00000000000000000000000000100010
*)