#include using namespace std; int main() { int n; cin >> n; cout << (3 - n % 3) % 3 << endl; }