#include using namespace std; typedef long long int ll; ll ans=0,piece,pos,j,temp,times; int main() { int n; cin>>n; std::vector v(n+1); for (int i = 1; i <= n; i++) cin>>v[i]; for (int i = 1; i <= n; i++) { j=0; temp=pow(2,j); while(pow(2,j)0) { ans+=piece; temp/=2; piece*=2; } } cout<