#include using namespace std; string s = "285714"; int main() { int n; cin >> n; cout << s[(n-1)%6] << endl; return 0; }