<?php

$states = array();

for ($i = 0; $i <= 1000; $i++) {
	for ($j = 0; $j <= 1000; $j++) {
		if (isset($states[$i + $j])) {
			$states[$i + $j] ++;
		} else {
			$states[$i + $j] = 1;
		}
	}
}

while ($n = trim(fgets(STDIN))) {
	$count = 0;
	for ($a = 0; $a <= 1000; $a++) {
		if ($n - $a < 0) {
			break;
		}
		for ($b = 0; $b <= 1000; $b++) {
			$v = $n - $a - $b;
			if ($v < 0) {
				break;
			}
			if ($v >= 2001) {
				continue;
			}
			$count += $states[$v];
		}
	}
	echo "$count\n";
}