#include <bits/stdc++.h>
using namespace std;
const int mo = 360;
inline unsigned long long Readint() {
  unsigned long long ret = 0;
  int f = -1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f *= -1;
  } while (ch >= 0 && (ch < '0' || ch > '9'));
  while ('0' <= ch && ch <= '9') {
    ret = ret * 10 + ch - '0';
    ch = getchar();
  }
  ret %= mo;
  if (f > 0)
    return ret;
  else
    return mo - ret;
}
void open() {
  freopen("M.in", "r", stdin);
  freopen("M.out", "w", stdout);
}
void close() {
  fclose(stdin);
  fclose(stdout);
}
int cnt[400] = {0};
int x;
int main() {
  int _ = 0;
  x = Readint();
  memset(cnt, -1, sizeof(cnt));
  cnt[x] = 0;
  do {
    x = (x + 90) % mo;
    if (cnt[x] >= 0) break;
    cnt[x] = ++_;
  } while (1);
  int ret = 1e9;
  for (int i = 0, _END_ = 180; i <= _END_; i++)
    if (cnt[i] >= 0 || cnt[360 - i] >= 0) {
      if (cnt[i] >= 0) ret = cnt[i];
      if (cnt[360 - i] >= 0) ret = min(ret, cnt[360 - i]);
      printf("%d\n", ret);
      break;
    }
  close();
  return 0;
}
