#include <bits/stdc++.h>
using namespace std;
signed long long int an(signed long long int x) {
  signed long long int ans1, ans2, ans;
  signed long long int a = x % 360;
  ans1 = abs(a) < abs((a + 360) % 360) ? a : (a + 360) % 360;
  ans2 = abs(a) < abs((a - 360) % 360) ? a : (a - 360) % 360;
  ans = abs(ans1) < abs(ans2) ? ans1 : ans2;
  return (ans);
}
int main() {
  signed long long int n, turns[4], turns_abs[4];
  cin >> n;
  turns[0] = n % 360;
  if (abs(turns[0]) >= 315) {
    cout << 0;
    return (0);
  }
  turns_abs[0] = (abs(turns[0] - 270) == abs(turns[0] - 360))
                     ? abs(turns[0] - 360)
                     : abs(turns[0]);
  turns_abs[0] = abs(turns[0]);
  signed long long int min = turns_abs[0], minind = 0;
  for (signed long long int i = 1; i < 4; i++) {
    turns[i] = (turns[i - 1] - 90) % 360;
    turns_abs[i] = abs(an(turns[i]));
    if (min > turns_abs[i]) {
      min = turns_abs[i];
      minind = i;
    }
  }
  cout << minind;
  return 0;
}
