#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 10;
long long n, m, k, c[maxn], f[maxn], size[maxn], ans, tot;
struct node {
  long long x, y, sz;
  node(long long a = 0, long long b = 0, long long c = 0) {
    x = a;
    y = b;
    sz = c;
  }
} Stack[maxn * 5];
bool use[maxn];
map<pair<long long, long long>, vector<pair<long long, long long> > > Map;
inline long long find(long long x) { return x == f[x] ? x : find(f[x]); }
inline void Link(long long x, long long y) {
  long long fx = find(x), fy = find(y);
  if (fx == fy) return;
  if (size[fx] > size[fy]) swap(fx, fy);
  Stack[++tot] = node(fx, fy, size[fx]);
  size[fy] += size[fx];
  f[fx] = fy;
}
inline void Pop() {
  while (tot) {
    size[Stack[tot].y] -= Stack[tot].sz;
    f[Stack[tot].x] = Stack[tot].x;
    --tot;
  }
}
inline bool Merge(long long x, long long y) {
  if (find(x) == find(y)) return 0;
  Link(x, n + y);
  Link(x + n, y);
  return 1;
}
signed main() {
  scanf("%lld%lld%lld", &n, &m, &k);
  for (long long i = (1), _end_ = (n); i <= _end_; ++i) scanf("%lld", &c[i]);
  for (long long i = (1), _end_ = (n + n); i <= _end_; ++i) {
    f[i] = i;
    size[i] = 1;
  }
  for (long long i = (1), _end_ = (m); i <= _end_; ++i) {
    long long u, v;
    scanf("%lld%lld", &u, &v);
    if (c[u] > c[v]) swap(u, v);
    if (c[u] == c[v])
      use[c[u]] |= !Merge(u, v);
    else
      Map[pair<long long, long long>(c[u], c[v])].push_back(
          pair<long long, long long>(u, v));
  }
  for (long long i = (1), _end_ = (k); i <= _end_; ++i)
    if (!use[i]) ++ans;
  ans = ans * (ans - 1) / 2;
  tot = 0;
  for (auto it : Map) {
    long long i = it.first.first, j = it.first.second;
    if (use[i] || use[j]) continue;
    for (auto fuck : it.second)
      if (!Merge(fuck.first, fuck.second)) {
        --ans;
        break;
      }
    Pop();
  }
  printf("%lld\n", ans);
  return 0;
}
