    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <string>

    using namespace std;

    int threediv(std::vector<int> &nums) {
        if (nums.size() < 2)
            return 0;

        int threedivs = 0;

        sort(nums.begin(), nums.end());

        for (int i = 0; i < nums.size() - 2; ++i) {
            for (int j = 1; j < nums.size() - 1; ++j) {
                for (int k = 2; k < nums.size(); ++k) {
                    if (i == j || i == k || j == k) continue;
                    if (nums[j] % nums[i] == 0 && nums[k] % nums[j] == 0) {
                        ++threedivs;
                    }
                }
            }
        }

        return threedivs;
    }


    int main() {
        int n;
        std::vector<int> nums;
        nums.reserve(n);

        cin >> n;
        for (int _n = 0; _n < n; ++_n) {
            int num;
            cin >> num;
            nums.push_back(num);
        }

        int threedivs = threediv(nums);
        std::cout << threedivs;
    }
