scoreboard players set #TEMP3 howmanychickens 0
scoreboard players operation #TEMP3 howmanychickens = @s howmanychickens
execute at @s as @e[type=minecraft:marker,tag=ride] if score @s howmanychickens = #TEMP3 howmanychickens run tag @s add temp
execute at @s as @e[type=minecraft:wandering_trader,tag=ride] if score @s howmanychickens = #TEMP3 howmanychickens run tag @s add temp
execute at @s as @e[type=minecraft:wandering_trader,tag=ride] run data modify entity @e[type=minecraft:wandering_trader,sort=nearest,limit=1] wander_target set value [I;0,0,0]

execute at @s[type=minecraft:marker,tag=temp,tag=ride] store result entity @e[type=minecraft:wandering_trader,tag=temp,sort=nearest,limit=1] wander_target[0] int 1 run data get entity @s Pos[0]
execute at @s[type=minecraft:marker,tag=temp,tag=ride] store result entity @e[type=minecraft:wandering_trader,tag=temp,sort=nearest,limit=1] wander_target[1] int 1 run data get entity @s Pos[1]
execute at @s[type=minecraft:marker,tag=temp,tag=ride] store result entity @e[type=minecraft:wandering_trader,tag=temp,sort=nearest,limit=1] wander_target[2] int 1 run data get entity @s Pos[2]

tag @e remove temp