#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int t=6; auto f=[&](sr a,sr b)->sr{ sr res=a; rep(i,t){ int xa=a[i]-'0'; int xb=b[i]-'0'; xa=(xa+xb)%10; res[i]='0'+xa; } return res; }; auto ff=[&](sr a,int x)->sr{ rep(i,t){ int d=a[i]-'0'; d*=x; d%=10; a[i]='0'+d; } return a; }; sets; vcv(t); rep(i,t)cin>>v[i]; rep(i,1000000){ auto ni=i; sr now=sr(t,'0'); rep(j,t){ int a=ni%10; now=f(now,ff(v[j],a)); ni/=10; } s.insert(now); } int ans=s.size(); cout<