import java.io.*
import java.lang.*
import java.lang.Math.*

const val EPS = 1e-9;
fun DBLEQ(a: Double, b: Double): Boolean {return Math.abs(a - b) < EPS}
open class Pnt2(var x: Double, var y: Double) {
    constructor(x: Int, y: Int): this(x.toDouble(), y.toDouble())
    override operator fun equals(other: Any?): Boolean {
        return if (other is Pnt2) {
            DBLEQ(this.x, other.x) && DBLEQ(this.y, other.y)
        } else {
            false
        }
    }
}
class Vec2(x: Double, y: Double) : Pnt2(x, y) {
    constructor(x: Int, y: Int) : this(x.toDouble(), y.toDouble())
    constructor(pt: Pnt2): this(pt.x, pt.y)
    operator fun plusAssign(other: Vec2): Unit {
        this.x += other.x
        this.y += other.y
    }
    operator fun plus(other: Vec2): Vec2 {
        return Vec2(this.x + other.x, this.y + other.y)
    }
    operator fun minusAssign(other: Vec2): Unit {
        this.x -= other.x
        this.y -= other.y
    }
    operator fun minus(other: Vec2): Vec2 {
        return Vec2(this.x - other.x, this.y - other.y)
    }
    operator fun unaryMinus(): Vec2 {
        return Vec2(-this.x, -this.y)
    }
    operator fun timesAssign(s: Double): Unit {
        this.x *= s
        this.y *= s
    }
    operator fun timesAssign(s: Int): Unit {
        timesAssign(s.toDouble())
    }
    operator fun times(s: Double): Vec2 {
        return Vec2(this.x * s, this.y * s)
    }
    operator fun times(s: Int): Vec2 {
        return times(s.toDouble())
    }
    operator fun divAssign(s: Double): Unit {
        this.x /= s
        this.y /= s
    }
    operator fun divAssign(s: Int): Unit {
        divAssign(s.toDouble())
    }
    operator fun div(s: Double): Vec2 {
        return Vec2(this.x / s, this.y / s)
    }
    operator fun div(s: Int): Vec2 {
        return div(s.toDouble())
    }
    fun dot(other: Vec2): Double {
        return this.x*other.x + this.y*other.y
    }
    fun isOrthogonal(other: Vec2): Boolean {
        return DBLEQ(this.dot(other), 0.0)
    }
    fun cross(other: Vec2): Double {
        return this.x*other.y - this.y*other.x
    }
    fun isParallel(other: Vec2): Boolean {
        return DBLEQ(this.cross(other), 0.0)
    }
    val norm2: Double
        get() {return this.x*this.x + this.y*this.y}
    val norm: Double
        get() {return sqrt(this.norm2)}
    fun rotateRad(t: Double): Vec2 {
        return if (DBLEQ(t, PI/2)) {
            Vec2(-this.y, this.x)
        } else if (DBLEQ(t, -PI/2)) {
            Vec2(this.y, -this.x)
        } else {
            Vec2(cos(t)*this.x - sin(t)*this.y,
                    sin(t)*this.x + cos(t)*this.y)
        }
    }
    fun rotateDeg(t: Int): Vec2 {
        return this.rotateRad(t* PI/180)
    }
    val ort: Int
        get() {
            return if (DBLEQ(this.x, 0.0) && DBLEQ(this.y, 0.0)) {
                0
            } else if (this.y > 0) {
                if (this.x > 0) 1 else 2
            } else {
                if (this.x > 0) 4 else 3
            }
        }
    operator fun compareTo(other: Vec2): Int {
        val to = this.ort
        val oo = other.ort
        return if (to != oo) {
            when {
                to < oo -> 1
                oo < to -> -1
                else -> 0
            }
        } else {
            when {
                this.cross(other) > 0 -> 1
                this.cross(other) < 0 -> -1
                else -> 0
            }
        }
    }
    val arg: Double
        get() {return Math.atan2(this.y, this.x)}
    fun position(other: Vec2): Int {
        val a = this
        val b = other
        if (a.cross(b) > EPS) return COUNTER_CLOCKWISE
        if (a.cross(b) < -EPS) return CLOCKWISE
        if (a.dot(b) < -EPS) return ONLINE_BACK
        if (a.norm < b.norm) return ONLINE_FRONT
        return ON_SEGMENT
    }
}
const val COUNTER_CLOCKWISE = 1
const val CLOCKWISE = -1
const val ONLINE_BACK = 2
const val ONLINE_FRONT = -2
const val ON_SEGMENT = 0

fun solve() {
    val X = rd.readInt()

    var k = 0
    var pos = Vec2(0,0)
    var dv = Vec2(0, 1)
    while (true) {
        pos = pos + dv
        k++
        if (pos == Vec2(0,0)) {
            break
        }
        dv = dv.rotateDeg(X)
    }

    val ans = k
    println(ans)
}


//val rd = debug.Reader("agc", "046", "a", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 34624