import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long metod(long a){ long sum =a; long b = a; while(b!=1){ if(b%2==0){ sum += b/2; b = b/2; }else if(b%2!=0 &&(Math.sqrt(b) ==(long)Math.sqrt(b))){ sum+=Math.sqrt(b); b = (long) Math.sqrt(b); }else{ sum+=1; b=1; } } return sum; } static long longestSequence(long[] a) { long sum = 0; long sumUkupno =0; long r = 0; for(int i = 0;i1){ sum = (a[i]+1); sumUkupno +=sum; }else if(a[i]%2==0){ sum = metod(a[i]); sumUkupno +=sum; }else{ sum = 1; sumUkupno +=sum; } } return sumUkupno; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result = longestSequence(a); System.out.println(result); in.close(); } }