#include using namespace std; using ll = long long; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> a >> b; int p,q; rep(i,4){ if(a==s[i]) p = i; } rep(i,4){ if(b==s[i]) q = i; } cout << (q+4-p)%4 << endl; return 0; }