Lùa bò cơ bản

View as PDF

Points: 100 Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

Cho mảng a kích thước n là hoán vị của các số từ 1 tới n.

Yêu cầu: Hãy đếm số cặp (i, j) (1 ≤ i < j ≤ n) sao cho ai * aj = i + j..

Input

Dòng đầu gồm n (1 ≤ n ≤ 2 * 10^6)

Dòng tiếp theo gồm n, số thứ i là giá trị của ai (1 ≤ ai ≤ n)

Output

Gồm một dòng duy nhất là đáp án cần tìm


Comments

Most recent
Loading comments...

There are no comments at the moment.