fun main() {
    val exteriorangle = readLine()!!.trim().toInt()
    val interiorangle=180-exteriorangle
    var rest:Int=360%exteriorangle
    var ans:Int = 360/exteriorangle
    var n:Int = 1
     while(rest!=0){

         var sumoftheinteriorangle = n*interiorangle
         rest=sumoftheinteriorangle%360
         n++
         ans=n-1
     }
    println(ans)
}