/*************************************************\
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long               ll;
typedef     long double             ld;
typedef     unsigned long long      ull;
typedef     vector<int>             vci;
typedef     vector<ll>              vcl;
typedef     pair<int,int>           pii;
typedef     pair<ll,ll>             pll;
typedef     vector<pll>             vpl;
typedef     vector<pii>             vpi;
typedef     map<ll,ll>              mll;
typedef     map<int,int>            mii;

#define         sci(x)         scanf("%d",&x)
#define         scii(x,y)      scanf("%d%d",&x,&y)
#define         sciii(x,y,z)   scanf("%d%d%d",&x,&y,&z)
#define         scl(x)         scanf("%lld",&x)
#define         scll(x,y)      scanf("%lld%lld",&x,&y)
#define         sclll(x,y,z)   scanf("%lld%lld%lld",&x,&y,&z)
#define         sclu(x)        scanf("%llu",&x)
#define         scc(x)         scanf("%c",&x)
#define         scs(x)         scanf("%s",&x)
#define         pfi(x)         printf("%d\n",x)
#define         pfii(x,y)      printf("%d %d\n",x,y)
#define         pfl(x)         printf("%lld\n",x)
#define         pfll(x,y)      printf("%lld %lld\n",x,y)
#define         pflu(x)        printf("%llu\n",x)
#define         pfs(s)         printf("%s",s.c_str())
#define         pyes           puts("YES")
#define         pno            puts("No")
#define         nel            printf("\n")
#define         spc            ' '
#define         nn             '\n'

#define         all(a)         a.begin(),a.end()
#define         sajo(str)      sort(str.begin(),str.end())
#define         rev(str)       reverse(str.begin(),str.end())
#define         usajo(str)     sort(str.rbegin(),str.rend())
#define         vin(a)         for(auto &it : a) cin>>it
#define         vout(a)        for(auto it : a) cout<<it<<spc;cout<<nn
#define         pb             push_back
#define         eb             emplace_back
#define         mkp(x,y)       make_pair(x,y)
#define         F              first
#define         S              second
#define         yes            cout<<"YES"<<"\n"
#define         no             cout<<"NO"<<"\n"

#define         rep(i,n)       for ( i=0 ; i<n ; ++i )
#define         rep1(i,n)      for ( i=1 ; i<=n ; ++i )

#define         pi             2*acos(0.0)
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         mem(a,b)       memset(a,b,sizeof (a))
#define         dec(x)         cout<<fixed<<setprecision(x)
#define         min3(a,b,c)    min(a,min(b,c))
#define         max3(a,b,c)    max(a,max(b,c))

const   int  N2  =   1e6+7;
const   int  N   =   2e5+7;
const   int  M   =   1e9+7;
const   int  imx =   2147483647;
const   ll   lmx =   92233720368547758;

int main() {ikarus_101

      ll n,m,i,j,k,x;


      cin >> n;
      ll ans = 0;
      ll cnt = 0;
      while(true)
      {
          ++cnt;ans+=n;
          if(ans % 360 == 0) return cout<<cnt<<nn,0;
      }

      return 0;
}


Measured memory_bytes: 3604