#include<algorithm>
#include<iostream>

int n;
int sum[2001];

int main()
{
	for( int i = 0; i <= 1000; ++i )
		for( int j = 0; j <= 1000; ++j )
			++sum[i + j];

	while( std::cin >> n )
	{
		int ans = 0;
		for( int a = 0; a <= 2000; ++a )
		{
			if( n - a < 0 || n - a > 2000 )
				continue;

			ans += sum[a] * sum[n-a];
		}

		std::cout << ans << std::endl;
	}

	return 0;
}