#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int n; cin>>n; vector c(9,0); rep(i,n){ int a; cin>>a; c[a] ++; } mint ans = 0; rep(i,9){ rep(j,9){ mint t = mint(i).pow(j); t *= c[i]; t *= c[j]; ans += t; } } cout<