import java.util.* ;
public class micro_tgr {
   public static void main(String[] args) throws Exception {
      Scanner sc = new Scanner(System.in) ;
      int n = sc.nextInt() ;
      long[] a = new long[10] ;
      a[0] = 1 ;
      long tot = 1 ;
      for (int i=0; i<n; i++) {
         long[] na = new long[10] ;
         int lim = sc.nextInt() ;
         tot *= lim ;
         for (int j=0; j<lim; j++)
            for (int d=0; d<10; d++)
               if (10 * d + j % 10 < lim && 10 * d + j / 10 < lim)
                  na[j % 10] += a[d] ;
         a = na ;
      }
      for (int d=0; d<10; d++)
         tot -= a[d] ;
      System.out.println(tot) ;
   }
}
