#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def main():
    for line in stdin:
        n = int(line)
        count = 0

        for a in range((n if n < 1000 else 1000) + 1):
            for ab in range(a, a+1001):
                if ab > n:
                    break

                nab = n - ab
                start = nab if nab < 1000 else 1000
                end = (nab-1001) if (nab-1001) > -1 else -1
                combi = start - end
                if combi >= 0:
                    count += combi

        print(count)
    exit()


if __name__ == '__main__':
    main()