Wrote a program for counting from starting to end