The provinces of Mendoza and San Juan, in the central west portion of Argentina, lie at the foot of the highest Andean ranges along the border with Chile. The city of Mendoza and its surrounding departments are in Mendoza Province's northern portion, 1,040 km (646 mi) from Buenos Aires but only 360 km (224 mi) from Santiago, Chile. The east-west Ruta Nacional 7 (RN7 Pan Americano or Panamerican Highway) crosses the Andes from Mendoza to Chile and links Argentina and neighboring southern cone countries (Brazil, Uruguay, Paraguay) with Pacific ports. Ruta Nacional 40 runs north-south the length of the country, passing through San Juan and down to Mendoza, the Valle de Uco, and San Rafael.