Task #M030C

Memory 16 MB Time 1000 ms Complexity 15 %
14

  

CTRL+P

If you have knowledge in the computer field that means you also know about “printer”.  In order to print out any kind of material you just need to click to print button. Sometimes we could only print some pages from documents, in this process we must only tell which pages need to be printed. For example, if you want to print fifth, tenth and nineteenth pages you have to put coma, after each given page like 5,10,19. In addition, you can also print all pages between given pages, for that you need to put “-“ (dash). Before the “-“ (dash) you have to write a page number which it  should start printing otherwise it will automatically  print from the beginning of the document.  And after “-“(dash) (on the right side of the dash) you need to say till which page it should print out, however again if you don`t put a number after ‘-‘ (dash) it will print till the end of the document. For example, if you want to print all pages from 25 to 35 you have to write: “25-35”.

At the moment you are preparing for an algorithm and programming competitions, so you need some pages from 2624-page book http://e-maxx.ru/bookz/files/tucker.pdf book . You wanted to print the book and wrote S line in the page selection part.

With the given S line find out how many white sheets you need to put in.


Input:

In a line of input file you need to put S line with no more than 1000


Output:

Print a single integer in the output file, how much paper the printer will need

Remember:  you may have printed some pages over and over again in a given S line.


Examples
# input.txt output.txt
1
1-3,5,7,10-13
9
Submit answer
Please, sing in, to complete this action, if you don't have account, you can sign up any moment