import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn= new Scanner(System.in);
int n= scn.nextInt();
int p,rem,ans=0;
for(int i=1;i<=n;i++){
int num=scn.nextInt();
while(num!=0){
rem=num%10;
int x=((int)rem*(Math.pow(2,p)));
num=num/10;
p++;
ans=ans+x;}
System.out.println(ans);
}