Submit | All submissions | Best solutions | Back to list |
EIULOGFILE - Log files |
Anh Phi is assisting the IT department in evaluating the operation of the Websites system of the whole company. The system has many Webistes, running on dozens of servers.Mr. Phi suspected there was a problem with the log system of the entire Websites.
The system stores Log on a text file, named based on Timestamp, which is the number of milliseconds from January 1, 1970 to the time of logging. For example, the Timestamp of 2017/03/01 is 14883264000000. For simplicity, we can understand the Log File name as a Long 64bits number.
Mr. Phi noticed that Log Files with Timestamps which are different no more than 10 minutes (10*60*1000 = 600,000) sometimes contain overlapping events. Mr. Phi has built a program, it takes 1s to check if 2 Log Files have the same event or not.
Please help Phi calculate how much time it takes to check all Log Files.
Input
The first line contains an integer n (n ≤ 105) which is the number of Log Files in the system..
The second line contains n integers ai (ai ≤ 1018) which is a list of Log Files names..
Output
A single line containing an integer is the time it takes to check all the Log Files.
Example
Input: 3 0 590000 1200000 Output: 1 Input 6 0 300000 2400000 3000000 2700000 2500000 Output 7
Giải thích: các cặp LogFiles cần kiểm tra là (0, 300000), (2400000, 3000000), (2400000, 2700000), (2400000, 2500000), (3000000, 2700000), (3000000, 2500000), (2700000, 2500000)
Added by: | Ha Minh Ngoc |
Date: | 2017-03-15 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |