#include using namespace std; using ll = long long; constexpr ll mod = 998244353; template struct Mint { using M=Mint; ll v; M& put(ll x) { v=(x>=1; } return res; } M inv() { return pow(mod-2); } }; using mint = Mint; int main(){ int n; cin >> n; vector a(n); for(int i = 0; i < n; ++i){ cin >> a[i]; } sort(a.begin(), a.end()); mint ans = 0; for(auto x : a){ ans = ans * 10 + x; } cout << ans.v << endl; }