#include <bits/stdc++.h>
using namespace std;
const int iinf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f3f;
const int N = 5e5;
int n, m, k, c[N], good;
bool bad[N];
map<pair<int, int>, int> mp;
int mc;
pair<int, int> me[N];
vector<pair<int, int>> e[N];
struct dsu {
  int te[N], dep[N];
  int find(int u) {
    if (te[u] == u) return u;
    int an = find(te[u]);
    dep[u] ^= dep[te[u]];
    return te[u] = an;
  }
} d[2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n >> m >> k, good = k;
  for (int i = (0), iE = (n); i < iE; i++) cin >> c[i], --c[i];
  for (int i = (0), iE = (m); i < iE; i++) {
    int u, v;
    cin >> u >> v, --u, --v;
    if (c[u] > c[v]) swap(u, v);
    pair<int, int> t = make_pair((c[u]), (c[v]));
    if (!mp.count(t)) mp[t] = mc, me[mc] = t, mc++;
    e[mp[t]].push_back(make_pair((u), (v)));
  }
  iota(d[0].te, d[0].te + n, 0);
  for (int i = (0), iE = (k); i < iE; i++)
    if (mp.count(make_pair((i), (i)))) {
      for (pair<int, int> t : e[mp[make_pair((i), (i))]]) {
        int first = d[0].find(t.first), second = d[0].find(t.second);
        if (first == second &&
            (d[0].dep[t.first] ^ d[0].dep[t.second] ^ 1) != 0) {
          bad[i] = true, good--;
          break;
        }
        d[0].dep[first] = d[0].dep[t.first] ^ d[0].dep[t.second] ^ 1,
        d[0].te[first] = second;
      }
    }
  long long ans = 1ll * good * (good - 1) / 2;
  for (int i = (0), iE = (mc); i < iE; i++)
    if (me[i].first != me[i].second) {
      if (bad[me[i].first] || bad[me[i].second]) continue;
      for (pair<int, int> t : e[i]) {
        int xi = d[0].find(t.first), yi = d[0].find(t.second);
        d[1].dep[xi] = 0, d[1].te[xi] = xi, d[1].dep[yi] = 0, d[1].te[yi] = yi;
      }
      for (pair<int, int> t : e[i]) {
        int xi = d[0].find(t.first), yi = d[0].find(t.second);
        int first = d[1].find(xi), second = d[1].find(yi);
        if (first == second && (d[1].dep[xi] ^ d[0].dep[t.first] ^
                                d[1].dep[yi] ^ d[0].dep[t.second] ^ 1) != 0) {
          ans--;
          break;
        }
        d[1].dep[first] = d[1].dep[xi] ^ d[0].dep[t.first] ^ d[1].dep[yi] ^
                          d[0].dep[t.second] ^ 1,
        d[1].te[first] = second;
      }
    }
  cout << ans << '\n';
  return 0;
}
