Task: Question Answering
Input (English): Passage: In 993, Khitans under General Xiao Sunning invaded Korea, but retreated after truce negotiations with minister Seo Hui of Goryeo, establishing friendly relations between the two nations. In 1004, the Liao dynasty repulsed Song China. Subsequently, as part of peace negotiations, Song China to paid tribute to the Liao emperor. However, the tension between Goryeo and Liao created another war. In 1009, General Gang Jo of Goryeo led a coup against King Mokjong, killing the king and establishing military rule. In 1010, the alliance was broken and Liao attacked Korea for General Gang's treason. Also, Khitans claimed six garrison settlements east of the Yalu River, which Goryeo claimed as its territory in truce negotiations during 993. After suffering numerous and heavy casualties against the Goryeo army, the Khitans managed to defeat Gangjo, who had begun to underestimate them. Despite this defeat, the Goryeo king managed to retain his claim on the six garrison settlements. The Khitans retreated from the peninsula, with no great prize for the war, but they did not give up their hope of gaining the six garrison settlements and making Goryeo pay tribute. However, beginning in the summer of 1018, the Khitans constructed a bridge across the Yalu River. 
Question: How many times was Korea attacked? 
Answer type: Number 
Output (English): 2.