#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) ;
#endif


typedef long long ll;
typedef long double ld;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)((x).size())
#define pb push_back
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
#define X first
#define Y second
//#define debug(x) cerr << #x << " : " << (x) << " "
const double PI = 3.14159265358979323846;
//const double eps = (1e-9);
//int isGreater(long double x, long double y)
//{
//    if (abs(x - y) < eps)
//        return 0;
//    if (x > y)
//        return 1;
//    return -1;
//}

const long double EPS = 1e-10;


bool areEqual(long double x, long double y, long double eps = EPS) {
    auto diff = abs(x - y);
    x = abs(x), y = abs(y);
    if (diff <= eps) return true;
    if (min(x, y) <= eps) return false;
    return diff <= eps * max(x, y);
}
enum Relation { LESS_THAN, EQUAL, GREATER_THAN };
// SUPER SLOW
int compareDoubles(long double x, long double y, long double eps = EPS) {
    if (areEqual(x, y)) return Relation::EQUAL; // CHANGE TO abs(x - y) <= eps for fastness
    if (x < y) return Relation::LESS_THAN;
    return Relation::GREATER_THAN;
}

bool isZero(long double x, long double eps = EPS) { return abs(x) <= eps; }
template <class T>
struct Point {
    typedef Point P;
    const static P Invalid;
    const static P Origin;

    T x = 0, y = 0;
    Point(T x, T y) : x(x), y(y) {}
    Point() {}
    pair<T, T> to_pair() const { return make_pair(x, y); }
    Point operator+(const Point& p) const { return Point{x + p.x, y + p.y}; }
    Point operator-(const Point& p) const { return Point{x - p.x, y - p.y}; }
    Point operator*(T c) const { return Point(x * c, y * c); }
    Point operator/(T c) const { return Point(x / c, y / c); }
    bool operator<(const Point& p) const {
        return (*this) != p && to_pair() < p.to_pair();
    }
    bool operator>(const Point& p) const { return (*this) != p && !(*this < p); }
    bool operator==(const Point& p) const {
        return isZero(this->x - p.x) && isZero(this->y - p.y);
    }
    bool operator!=(const Point& p) const { return !(*this == p); }
    T cross(const P& p) const { return x * p.y - y * p.x; }
    T cross(const P& a, const P& b) const { return (a - *this).cross(b - *this); } // v.cross(a, b) v is the common point
    T dot(const P& p) const { return x * p.x + y * p.y; }
    P midPoint(const P& p) const { return ((*this) + p) / 2; }
    P getVector(const P& p) const { return p - (*this); } // v.getVector(p). vector from v to p
    T dist2(const P& p) const { return getVector(p).len2(); }
    T len2() const { return (*this).dot(*this); }
    long double dist(const P& p) const { return sqrt(dist2(p)); }
    long double len() const { return sqrt(len2()); }
    P rotateCCW90() const { return P(-y, x); }
    P rotateCCW90Around(const P& p) const { // rotating this around p. I think rotateCCWAround can be done the same way
        return p + p.getVector(*this).rotateCCW90();
    }
    P rotateCCW(long double angle) const { // angle in radian
        return Point(x * cos(angle) - y * sin(angle),
                     x * sin(angle) + y * cos(angle));
    }
    P unit() const { return (*this) / len(); }

    // Project point onto line through a and b (assuming a != b).
    P projectOnLine(const P& a, const P& b) const {
        P ab = a.getVector(b);
        P ac = a.getVector(*this);
        return a + ab * ac.dot(ab) / a.dist2(b);
    }

    // Project point c onto line segment through a and b (assuming a != b).
    P projectOnSegment(const P& a, const P& b) const {
        P& c = *this;
        P ab = a.getVector(b);
        P ac = a.getVector(c);

        long double r = dot(ac, ab), d = a.dist2(b);
        if (r < 0) return a;
        if (r > d) return b;

        return a + ab * r / d;
    }

    P reflectAroundLine(const P& a, const P& b) const {
        return projectOnLine(a, b) * 2 - (*this);
    }

    friend istream& operator>>(istream& is, P& p) { return is >> p.x >> p.y; }

    friend ostream& operator<<(ostream& os, const P& p) {
        return os << p.x << " " << p.y;
    }
};

template <typename T>
const Point<T> Point<T>::Invalid = Point<T>(numeric_limits<T>::max(),
                                            numeric_limits<T>::max());
template <typename T>
const Point<T> Point<T>::Origin = Point<T>(0, 0);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("AC.txt", "w", stdout);
#endif
    int angle;
    cin >> angle;
    Point<long double> cur(0, 0), v(0, 1);
    int ans = 0;
    do{
        cur = cur + v;
        v = v.rotateCCW(1.0 * angle * PI / 180);
        ans++;
    }while(!(isZero(cur.x) && isZero(cur.y)));
    cout << ans << '\n';
}

Measured memory_bytes: 4012