#include <bits/stdc++.h>


using namespace std;


using ll = long long;


const ll mod = 1e9 + 7;


template<typename T>
ostream & operator <<(ostream &os, const vector<T> &a) {
    for (T el : a) {
        os << el << " ";
    }
    os << '\n';
    return os;
}


void dfs(const vector<vector<int>> &g, vector<bool> &used, int v) {
    used.at(v) = 1;
    for (int to : g.at(v)) {
        if (!used.at(to)) {
            dfs(g, used, to);
        }
    }
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, group;
    cin >> n >> m >> group;
    vector<vector<int>> g(n);
    vector<pair<int, int>> edges(m);
    for (int i = 0; i < m; i++) {
        int v, u;
        cin >> v >> u;
        v--;
        u--;
        g.at(v).push_back(u);
        edges.push_back({v, u});
    }
    vector<vector<bool>> go(n, vector<bool> (n, 0));
    for (int i = 0; i < n; i++) {
        dfs(g, go.at(i), i);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if ((go.at(i).at(j) || go.at(j).at(i)) && (go.at(i).at(k) || go.at(k).at(i)) && (go.at(j).at(k) || go.at(k).at(j))) {
                    ans++;
                }
            }
        }
    }
    cout << ans << '\n' << 0;
    return 0;
}
