include<stdio.h>
main(){
  int a,b,cnt=0,n;
  int ab[2001]={0};
  int abcd[4001]={0};

  for(a=0;a<=1000;a++)for(b=0;b<=1000;b++)ab[a+b]++;
  for(a=0;a<=2000;a++)for(b=0;b<=2000;b++)abcd[a+b]+=ab[a]*ab[b];
 
  while( scanf("%d",&b)!=EOF)
  printf("%d\n",abcd[b]);
  return 0;
}