/* -*- coding: utf-8 -*- * * 1828.cc: No.1828 Except 3 - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 10000; const int M = 3; /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); ll p = 1; for (int i = 0; i < M; i++) { int c = 0; for (int j = 0; j < n; j++) { int ai; scanf("%d", &ai); if (ai % 3) c++; } p *= c; } printf("%lld\n", p); return 0; }