#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  cin >> N;
  N = -N;
  long long d = abs(N / 360) + 10;
  if (N < 0) {
    N = 360 * d + N;
    long long cur = (N % 360);
    long long mn = min(cur, 360 - cur);
    int mv = 0;
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 1;
      mn = min(cur, 360 - cur);
    }
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 2;
      mn = min(cur, 360 - cur);
    }
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 3;
      mn = min(cur, 360 - cur);
    }
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 4;
      mn = min(cur, 360 - cur);
    }
    cout << mv << '\n';
  } else {
    long long cur = (N % 360);
    long long mn = min(cur, 360 - cur);
    int mv = 0;
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 1;
      mn = min(cur, 360 - cur);
    }
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 2;
      mn = min(cur, 360 - cur);
    }
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 3;
      mn = min(cur, 360 - cur);
    }
    cur = (cur + 90) % 360;
    if (mn > min(cur, 360 - cur)) {
      mv = 4;
      mn = min(cur, 360 - cur);
    }
    cout << mv << '\n';
  }
}
