n=1000
ab=Array.new(n*2+1,0)
(0..n).each do |a|
  (0..n).each do |b|
    ab[a+b]+=1
  end
end
while gets
  num,count=$_.to_i,0
  (0..num).each do |i|
    count+=ab[i]*ab[num-i] if num-i>0
  end
  p count
end