#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double eps = 1e7 - 8;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int maxm = 1e6 + 5;
int n;
int main(int argc, char const *argv[]) {
  std::ios::sync_with_stdio(false);
  scanf("%d", &n);
  printf("%d", n % 5 % 3 + 1);
  return 0;
}
