
memo = Array.new(2048, 0)

0.upto 1000 do |i|
  0.upto 1000 do |j|
    memo[i+j] += 1
  end
end

while n = gets.chomp.to_i

  ans = 0
  0.upto 2000 do |left|
    ans += memo[left] * memo[n - left] if n - left >= 0
  end

  puts ans
end