#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, q, w, x, y, flag = 0, sum = 0;
  char c;
  while (true) {
    c = getchar();
    if (c == '\n') break;
    sum = sum * 10 + int(c - '0');
    q = sum / 2;
    sum = sum % 2;
  }
  if (sum == 1 || q % 2 == 1)
    cout << "0\n";
  else
    cout << "4\n";
  return 0;
}
