The Egyptians were led by Saad el-Dawleh, former governor of Beirut, while the Crusaders were under the command of King Baldwin I. Baldwin had only 260 cavalry and 900 foot soldiers under his command, leaving him severely outnumbered by the Egyptian army, why was estimated at 32,000 men by Fulcher of Chartres and downgraded to 3,000-5,000 by modern historians. Upon sighting the Fatimid army Baldwin arrayed his forced in six divisions, commanding the reserve force himself. In the initial attack the first two Crusader divisions were wiped out while the vanguard took heavy casualties too, with Geldemar Carpinel among the slain. The battle seemed to be lost but when the third division was pursued after being routed by the Egyptians, Baldwin ordered a counter-attack and committed his reserve. In vicious close-quarter combat, the Crusaders repulsed the Egyptian forces, who retreated in panic as rank after rank buckled under the force of Baldwin's attack. After pursuing the fleeing Fatimids to Ascalon, Baldwin returned to Ramla to plunder the Egyptian camp. This success secured the Kingdom of Jerusalem against the Fatimid Caliphate's advances for the campaigning season. According to Fulcher of Chartres, who was present at the battle, The Fatimids lost around 5,000 men in the battle including their general Saad al-Daulah. However, Crusader losses were heavy too, losing 80 knights and a large amount of infantry.

Answer this question based on the article: How many more foot soldiers did Baldwin have than cavalry?
640