#define _GLIBCXX_DEBUG //遅い可能性がある #include #include using namespace atcoder; using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x) using ll = long long; using P = pair; using VI = vector; using VVI = vector>; int INF = 100100100; const vector dx = {1, 0, -1, 0}; const vector dy = {0, 1, 0, -1}; int main() { int n; cin >> n; VI A(n); rep(i,n) cin >> A[i]; VI B(n); rep(i,n) cin >> B[i]; VI C(n); rep(i,n) cin >> C[i]; int na = 0, nb = 0, nc = 0; rep(i,n) { if (A[i] % 3 != 0) na++; if (B[i] % 3 != 0) nb++; if (C[i] % 3 != 0) nc++; } ll ans = na*nb*nc; cout << ans << endl; return 0; }