#include <bits/stdc++.h>
using namespace std;
char str[100010];
int main() {
  int ans[] = {4, 0, 0, 0};
  while (~scanf("%s", str)) {
    int tmp = 0;
    int len = strlen(str);
    for (int i = 0; i < len; ++i) {
      tmp = tmp * 10 + str[i] - '0';
      tmp %= 4;
    }
    printf("%d\n", ans[tmp]);
  }
  return 0;
}
