#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a;
  cin >> a;
  int ans = 0;
  a += 360 * 2777777777777778;
  a %= 360;
  int cur = min(360 - a, a);
  a -= 90;
  a += 360;
  a %= 360;
  if (cur > min(360 - a, a)) ans = 1, cur = min(360 - a, a);
  a -= 90;
  a += 360;
  a %= 360;
  if (cur > min(360 - a, a)) ans = 2, cur = min(360 - a, a);
  a -= 90;
  a += 360;
  a %= 360;
  if (cur > min(360 - a, a)) ans = 3, cur = min(360 - a, a);
  a -= 90;
  a += 360;
  a %= 360;
  if (cur > min(360 - a, a)) ans = 4, cur = min(360 - a, a);
  cout << ans << endl;
}
