#include #include int main() { int n; int ans; scanf("%d",&n); ans=log2(n+1)-1; printf("%d",ans); return 0; }