The cows have just learned what a primitive root is! Given a prime *p*, a primitive root <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/f203bd9f1553a2d666452cec7d6f1f4f02a817fb.png" style="max-width: 100.0%;max-height: 100.0%;"/> is an integer *x* (1 ≤ *x* &lt; *p*) such that none of integers *x* - 1, *x*<sup class="upper-index">2</sup> - 1, ..., *x*<sup class="upper-index">*p* - 2</sup> - 1 are divisible by *p*, but *x*<sup class="upper-index">*p* - 1</sup> - 1 is. 

Unfortunately, computing primitive roots can be time consuming, so the cows need your help. Given a prime *p*, help the cows find the number of primitive roots <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/f203bd9f1553a2d666452cec7d6f1f4f02a817fb.png" style="max-width: 100.0%;max-height: 100.0%;"/>.
The input contains a single line containing an integer *p* (2 ≤ *p* &lt; 2000). It is guaranteed that *p* is a prime.
# Cows and Primitive Roots

# pre-calculei
prs = {"2": 1, "3": 1, "5": 2, "7": 2, "11": 4, "13": 4, "17": 8, "19": 6, "23": 10, "29": 12, "31": 8, "37": 12, "41": 16, "43": 12, "47": 22, "53": 24, "59": 28, "61": 16, "67": 20, "71": 24, "73": 24, "79": 24, "83": 40, "89": 40, "97": 32, "101": 40, "103": 32, "107": 52, "109": 36, "113": 48, "127": 36, "131": 48, "137": 64, "139": 44, "149": 72, "151": 40, "157": 48, "163": 54, "167": 82, "173": 84, "179": 88, "181": 48, "191": 72, "193": 64, "197": 84, "199": 60, "211": 48, "223": 72, "227": 112, "229": 72, "233": 112, "239": 96, "241": 64, "251": 100, "257": 128, "263": 130, "269": 132, "271": 72, "277": 88, "281": 96, "283": 92, "293": 144, "307": 96, "311": 120, "313": 96, "317": 156, "331": 80, "337": 96, "347": 172, "349": 112, "353": 160, "359": 178, "367": 120, "373": 120, "379": 108, "383": 190, "389": 192, "397": 120, "401": 160, "409": 128, "419": 180, "421": 96, "431": 168, "433": 144, "439": 144, "443": 192, "449": 192, "457": 144, "461": 176, "463": 120, "467": 232, "479": 238, "487": 162, "491": 168, "499": 164, "503": 250, "509": 252, "521": 192, "523": 168, "541": 144, "547": 144, "557": 276, "563": 280, "569": 280, "571": 144, "577": 192, "587": 292, "593": 288, "599": 264, "601": 160, "607": 200, "613": 192, "617": 240, "619": 204, "631": 144, "641": 256, "643": 212, "647": 288, "653": 324, "659": 276, "661": 160, "673": 192, "677": 312, "683": 300, "691": 176, "701": 240, "709": 232, "719": 358, "727": 220, "733": 240, "739": 240, "743": 312, "751": 200, "757": 216, "761": 288, "769": 256, "773": 384, "787": 260, "797": 396, "809": 400, "811": 216, "821": 320, "823": 272, "827": 348, "829": 264, "839": 418, "853": 280, "857": 424, "859": 240, "863": 430, "877": 288, "881": 320, "883": 252, "887": 442, "907": 300, "911": 288, "919": 288, "929": 448, "937": 288, "941": 368, "947": 420, "953": 384, "967": 264, "971": 384, "977": 480, "983": 490, "991": 240, "997": 328, "1009": 288, "1013": 440, "1019": 508, "1021": 256, "1031": 408, "1033": 336, "1039": 344, "1049": 520, "1051": 240, "1061": 416, "1063": 348, "1069": 352, "1087": 360, "1091": 432, "1093": 288, "1097": 544, "1103": 504, "1109": 552, "1117": 360, "1123": 320, "1129": 368, "1151": 440, "1153": 384, "1163": 492, "1171": 288, "1181": 464, "1187": 592, "1193": 592, "1201": 320, "1213": 400, "1217": 576, "1223": 552, "1229": 612, "1231": 320, "1237": 408, "1249": 384, "1259": 576, "1277": 560, "1279": 420, "1283": 640, "1289": 528, "1291": 336, "1297": 432, "1301": 480, "1303": 360, "1307": 652, "1319": 658, "1321": 320, "1327": 384, "1361": 512, "1367": 682, "1373": 588, "1381": 352, "1399": 464, "1409": 640, "1423": 468, "1427": 660, "1429": 384, "1433": 712, "1439": 718, "1447": 480, "1451": 560, "1453": 440, "1459": 486, "1471": 336, "1481": 576, "1483": 432, "1487": 742, "1489": 480, "1493": 744, "1499": 636, "1511": 600, "1523": 760, "1531": 384, "1543": 512, "1549": 504, "1553": 768, "1559": 720, "1567": 504, "1571": 624, "1579": 524, "1583": 672, "1597": 432, "1601": 640, "1607": 720, "1609": 528, "1613": 720, "1619": 808, "1621": 432, "1627": 540, "1637": 816, "1657": 528, "1663": 552, "1667": 672, "1669": 552, "1693": 552, "1697": 832, "1699": 564, "1709": 720, "1721": 672, "1723": 480, "1733": 864, "1741": 448, "1747": 576, "1753": 576, "1759": 584, "1777": 576, "1783": 540, "1787": 828, "1789": 592, "1801": 480, "1811": 720, "1823": 910, "1831": 480, "1847": 840, "1861": 480, "1867": 620, "1871": 640, "1873": 576, "1877": 792, "1879": 624, "1889": 928, "1901": 720, "1907": 952, "1913": 952, "1931": 768, "1933": 528, "1949": 972, "1951": 480, "1973": 896, "1979": 924, "1987": 660, "1993": 656, "1997": 996, "1999": 648, "2003": 720}

def main():
    p = input()
    print(prs[p])

if __name__ == '__main__':
    main()

	 	 		    				  		  	 			  		