#include using namespace std; using ll = long long; using Graph = vector>; long long primeNumber(long long x) { bool fire = true; for(int i = 2; i <= sqrt(x); i++) { if(x % i == 0) { fire = false; } } return fire; } int main() { int N; cin >> N; vector A(N); vector B(N); vector C(N); for(int i =0;i < N; i++) cin >> A[i]; for(int i = 0; i < N; i++) cin >> B[i]; for(int i = 0; i < N; i++) cin >> C[i]; int a = 0; int b = 0; int c = 0; for(int i = 0; i < N; i++) { if(A[i] % 3 != 0) { a++; } if(B[i] % 3 != 0) { b++; } if(C[i] % 3 != 0) { c++; } } cout << a * b * c << endl; }