var a,a1,a2,sum,n,i:integer; begin readln (n); for i:=1 to n do begin readln (a); a1:=a div 10; a2:=a mod 10; if (a1=1) or (a2=1) then sum:=sum+a; end; writeln (sum); end.