Gửi bài giải

Điểm: 1,50 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Ha Minh Ngoc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

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 ≤ ~10^{5}~) which is the number of Log Files in the system..

  • The second line contains n integers ~ai~ (~ai~ ≤ ~10^{18}~) 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.

Sample Input:

3 
0 590000 1200000    

Sample Output:

1 

Sample Input

6 
0 300000 2400000 3000000 2700000 2500000

Sample 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)


Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.