scoreboard players set min times_appeared 0

execute if score #life_hat shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = life_hat times_appeared
execute if score #life_hat shop matches 1 if score life_hat times_appeared < min times_appeared run scoreboard players operation min times_appeared = life_hat times_appeared

execute if score #rage_glasses shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = rage_glasses times_appeared
execute if score #rage_glasses shop matches 1 if score rage_glasses times_appeared < min times_appeared run scoreboard players operation min times_appeared = rage_glasses times_appeared

execute if score #basic_mage_tunic shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = basic_mage_tunic times_appeared
execute if score #basic_mage_tunic shop matches 1 if score basic_mage_tunic times_appeared < min times_appeared run scoreboard players operation min times_appeared = basic_mage_tunic times_appeared

execute if score #coin_chain shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = coin_chain times_appeared
execute if score #coin_chain shop matches 1 if score coin_chain times_appeared < min times_appeared run scoreboard players operation min times_appeared = coin_chain times_appeared

execute if score #steampunk_armor shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = steampunk_armor times_appeared
execute if score #steampunk_armor shop matches 1 if score steampunk_armor times_appeared < min times_appeared run scoreboard players operation min times_appeared = steampunk_armor times_appeared

execute if score #lava_boots shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = lava_boots times_appeared
execute if score #lava_boots shop matches 1 if score lava_boots times_appeared < min times_appeared run scoreboard players operation min times_appeared = lava_boots times_appeared

execute if score #heavy_boots shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = heavy_boots times_appeared
execute if score #heavy_boots shop matches 1 if score heavy_boots times_appeared < min times_appeared run scoreboard players operation min times_appeared = heavy_boots times_appeared
execute if score min times_appeared matches -1 run scoreboard players set min times_appeared 0