#include <cstdio>
template <int n> struct T
{
enum { value = n };
};
template <int l, int r, template <int> class Type> struct For
{
enum { value = For<l, (l + r) / 2, Type>::value + For<(l + r) / 2 + 1, r, Type>::value };
};
template <int l, template <int> class Type> struct For<l, l, Type>
{
enum { value = Type<l>::value };
};
int main()
{
int x = For<0, 1000, T>::value;
printf("%d\n", x);
return 0;
}