#include <bits/stdc++.h>
using namespace std;
int mod(string s, int m) {
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    ans = ((ans * 10) + s[i] - '0') % m;
  }
  return ans;
}
int main() {
  string s;
  cin >> s;
  int x = mod(s, 4);
  if (x == 1 || x == 2 || x == 3)
    cout << 0;
  else
    cout << 4;
  return 0;
}
