/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author https://github.com/rishabhdeepsingh/competitive
 */

// Created by White Knife on 15/04/20.
// doot diddly donger cuckerino Hahahahahah

#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC target("popcnt")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

// @formatter:off
#define F               first
#define S               second
#define all(x)          (x).begin(), (x).end()
#define sz(x)           int((x).size())
#define sim             template<typename T
#define ris             return *this
#define dor             > debug & operator <<
#define eni(x)          sim > typename enable_if<sizeof dud<T>(0) x 1, debug&>::type operator<<(T i)
sim> struct rge { T b, e; };
sim> rge<T> rang(T i, T j) { return rge<T>{i, j}; }
sim> auto dud(T *x) -> decltype(cerr << *x, 0);
sim> char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) { cerr << boolalpha << i; ris; }
  eni(==) { ris << rang(all(i)); }
  sim, typename U dor(pair<U, T> d) { ris << "(" << d.first << ", " << d.second << ")"; }
  sim dor(rge<T> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
  sim dor(const T&) { ris; }
#endif
};
#define pr(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ull = unsigned long long;
using ld = long double;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vb = vector<bool>;

using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

const ld PI = acos(-1);

template<typename T> inline T mini(T& x, T y) { return x = min(x, y); }
template<typename T> inline T maxi(T& x, T y) { return x = max(x, y); }
template<typename T> int sgn(T val) { return (T(0) < val) - (val < T(0));}
template<typename T> T rand(T x, T y) { return rand() % (y - x + 1) + x; }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T> T gcd(T x, T y) { return (y == T(0)) ? x : gcd(y, x % y); }
// @formatter:on





template <typename T>
struct Matrix {
  std::vector<std::vector<T>> matrix;
  std::size_t _rows;
  std::size_t _columns;

  Matrix() = default;

  Matrix(const std::size_t row_count, const std::size_t column_count) :
      _rows{row_count},
      _columns{column_count},
      matrix{row_count} {
    matrix.resize(row_count, std::vector<T>(column_count, 0));
    for (auto& m_rows : matrix) {
      m_rows.resize(_columns);
    }
  }

  Matrix(const std::size_t row_count, const std::size_t column_count, const T& value) :
      _rows(row_count),
      _columns(column_count),
      matrix(row_count) {
    for (std::size_t i = 0; i < _rows; ++i) {
      matrix[i].resize(_columns, value);
    }
  }

  Matrix(const std::vector<std::vector<T>>& x) :
      _rows{x.size()},
      _columns{x[0].size()} {
    matrix = std::move(x);
  }

  Matrix(const Matrix& other) = default;

  Matrix& operator=(const Matrix& other) = default;

  // Scalar Multiplication
  Matrix& operator*=(const T& scalar) {
    for (auto& _rows : matrix) {
      for (auto& cell : _rows) {
        cell *= scalar;
      }
    }
    return *this;
  }

  // Scalar Division
  Matrix& operator/=(const T& scalar) {
    for (auto& _rows : matrix) {
      for (auto& cell : _rows) {
        cell /= scalar;
      }
    }
    return *this;
  }

  // Modular Operator
  Matrix& operator%=(const T& mod) {
    for (std::size_t i = 0; i < _rows; i++) {
      for (std::size_t j = 0; j < _columns; j++) {
        matrix[i][j] %= mod;
      }
    }
    return *this;
  }

  // Matrix Multiplication
  Matrix& operator*=(const Matrix& other) {
    if (_columns != other._rows) {
      throw std::logic_error("column count of lhs and _rows count of rhs are not equal\n");
    }
    Matrix temp(_rows, other._columns, 0);

    for (std::size_t i = 0; i < temp._rows; i++) {
      for (std::size_t j = 0; j < temp._columns; j++) {
        for (std::size_t k = 0; k < _columns; k++) {
          temp[i][j] += matrix[i][k] * other[k][j];
        }
      }
    }
    std::swap(matrix, temp.matrix);
    std::swap(_columns, temp._columns);
    return *this;
  }

  // addition Operator
  Matrix& operator+=(const Matrix& other) {
    if (_rows != other._rows || _columns != other._columns) {
      throw std::logic_error("either or both of _rows count and column count of lhs and rhs are not equal\n");
    }
    for (std::size_t i = 0; i < _rows; i++) {
      for (std::size_t j = 0; j < _columns; j++) {
        matrix[i][j] += other[i][j];
      }
    }
    return *this;
  }

  // Subtraction Operator
  Matrix& operator-=(const Matrix& other) {
    if (_rows != other._rows || _columns != other._columns) {
      throw std::logic_error("either or both of _rows count and column count of lhs and rhs are not equal\n");
    }
    for (std::size_t i = 0; i < _rows; i++) {
      for (std::size_t j = 0; j < _columns; j++) {
        matrix[i][j] -= other[i][j];
      }
    }
    return *this;
  }

  Matrix<T> cofactor(int p, int q, int n) {
    int i = 0, j = 0;
    Matrix<T> temp(n, n);
    for (int _rows = 0; _rows < _rows; _rows++) {
      for (int col = 0; col < _columns; col++) {
        if (_rows != p && col != q) {
          temp[i][j++] = matrix[_rows][col];
          if (j == n - 1) {
            j = 0;
            i++;
          }
        }
      }
    }
    return temp;
  }

  T determinant() {
    int n = _rows;
    int num1, num2, det = 1, index, total = 1; // Initialize result

    T temp[n + 1];
    for (int i = 0; i < n; i++) {
      index = i;
      while (matrix[index][i] == 0 && index < n) {
        index++;
      }
      if (index == n) {
        continue;

      }
      if (index != i) {
        for (int j = 0; j < n; j++) {
          swap(matrix[index][j], matrix[i][j]);
        }
        det = det * pow(-1, index - i);
      }

      for (int j = 0; j < n; j++) {
        temp[j] = matrix[i][j];

      }
      for (int j = i + 1; j < n; j++) {
        num1 = temp[i];
        num2 = matrix[j][i];
        for (int k = 0; k < n; k++) {
          matrix[j][k] = (num1 * matrix[j][k]) - (num2 * temp[k]);
        }
        total = total * num1;
      }
    }
    for (int i = 0; i < n; i++) {
      det = det * matrix[i][i];
    }
    //Det(kA)/k=Det(A);
    return (det / total);
  }

  // Number of Rows
  std::size_t rows() const { return _rows; }

  // Number of Columns
  std::size_t columns() const { return _columns; }

  std::vector<T>& operator[](std::size_t _rows) { return matrix[_rows]; }

  const std::vector<T>& operator[](std::size_t _rows) const { return matrix[_rows]; }
};

//Matrix Transpose
template <typename T>
Matrix<T> operator!(const Matrix<T>& other) {
  Matrix<T> res(other.columns(), other.rows());
  for (auto _rows = 0; _rows < other.rows(); ++_rows) {
    for (auto col = 0; col < other.columns(); ++col) {
      res[col][_rows] = other[_rows][col];
    }
  }
  return res;
}

//Equals Operator
template <typename T>
bool operator==(const Matrix<T>& lhs, const Matrix<T>& rhs) {
  if (lhs.rows() != rhs.rows() || lhs.columns() != rhs.columns()) {
    return false;
  }
  for (auto i = 0; i < lhs.rows(); i++) {
    for (auto j = 0; j < lhs.columns(); j++) {
      if (lhs[i][j] != rhs[i][j]) {
        return false;
      }
    }
  }
  return true;
}

//Not-Equals Operator
template <typename T>
bool operator!=(const Matrix<T>& lhs, const Matrix<T>& rhs) { return !(lhs == rhs); }

//Add matrices
template <typename T>
Matrix<T> operator+(Matrix<T>& lhs, const Matrix<T>& rhs) { return lhs += rhs; }

//Subtract matrices
template <typename T>
Matrix<T> operator-(Matrix<T>& lhs, const Matrix<T>& rhs) { return lhs -= rhs; }

// Multiply Matrices
template <typename T>
Matrix<T> operator*(Matrix<T>& lhs, const Matrix<T>& rhs) { return lhs *= rhs; }

//Scalar multiplication
template <typename T, typename U>
Matrix<T> operator*(Matrix<T>& lhs, const U& rhs) { return lhs *= rhs; }

//Scalar Division
template <typename T, typename U>
Matrix<T> operator/(Matrix<T>& lhs, const U& rhs) { return lhs /= rhs; }

//Scalar modulo
template <typename T, typename U>
Matrix<T> operator%(Matrix<T>& lhs, const U& mod) { return lhs %= mod; }

template <typename T, typename U>
Matrix<T> operator*(const U& scalar, const Matrix<T>& lhs) { return lhs *= scalar; }

template <typename T>
Matrix<T> operator*(const T& lhs, const Matrix<T>& rhs) { return rhs *= lhs; }

// Power of a Matrix
template <typename T, typename U>
Matrix<T> power(Matrix<T> base, U exp) {
  Matrix<T> res = base;
  while (exp > 0) {
    if (exp & 1) {
      res *= base;
    }
    exp >>= 1;
    base *= base;
  }
  return res;
}

template <typename T, typename U>
Matrix<T> power(Matrix<T> base, U exp, T mod) {
  Matrix<T> res = base % mod;
  while (exp > 0) {
    if (exp & 1) {
      res *= base;
//      res %= MOD;
    }
    exp >>= 1;
    base *= base;
//    base %= MOD;
  }
  return res;
}

// Trace of Matrix
template <typename T>
T trace(Matrix<T>& matrix) {
  if (matrix.rows() != matrix.columns()) {
    throw std::logic_error("Not a square matrix\n");
  }
  T res = 0;
  for (std::size_t i = 0; i < matrix.rows(); ++i) {
    res += matrix[i][i];
  }
  return res;
}

template <typename T>
std::istream& operator>>(std::istream& is, Matrix<T>& matrix) {
  for (std::size_t i = 0; i < matrix.rows(); i++) {
    for (std::size_t j = 0; j < matrix.columns(); j++) {
      is >> matrix[i][j];
    }
  }
  return is;
}

template <typename T>
std::ostream& operator<<(std::ostream& os, const Matrix<T>& matrix) {
  for (std::size_t i = 0; i < matrix.rows(); i++) {
    for (std::size_t j = 0; j < matrix.columns(); j++) {
      os << matrix[i][j] << " \n"[j == matrix.columns() - 1];
    }
  }
  return os;
}

class ATakahashikunTheStrider {
public:
  
  void solve(std::istream& cin, std::ostream& cout) {
    ld x;
    cin >> x;
    x = 180 - x;
    x = x * PI / 180;
    int res = 0;
    ld eps(1e-3);
    Matrix<ld> p(2, 1, 0);
    Matrix<ld> q(2, 1, 1);
    q[1][0] = 0;
    while (res <= 400) {
      if (abs(q[0][0]) < eps and abs(q[1][0]) < eps) {
        break;
      }
      Matrix<ld> diff = p - q;
      Matrix<ld> m3(2, 1);
      m3[0][0] = cos(x) * diff[0][0] + sin(-x) * diff[1][0];
      m3[1][0] = sin(x) * diff[0][0] + cos(x) * diff[1][0];
      m3 += q;
      p = q;
      q = m3;
      assert(p != q);
      res++;
    }
    cout << res + 1 << '\n';
  }
};

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
	ATakahashikunTheStrider solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4168