scoreboard players set min times_appeared 0

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

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

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

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

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

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

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