#include <bits/stdc++.h>
using namespace std;
set<long long> s;
struct rua {
  long long x, u, v;
} a[500001];
long long n, m, k, c[500001], fa[500001], sz, cnt, ans;
bool cmp(rua x, rua y) { return x.x < y.x; }
long long Find(long long x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); }
long long qow(long long x, long long y) {
  return y ? (y & 1 ? x * qow(x, y - 1) % 1000000007
                    : qow(x * x % 1000000007, y / 2))
           : 1;
}
void add(long long u, long long v) {
  s.insert(u), s.insert(v);
  if (Find(u) != Find(v)) fa[Find(u)] = Find(v), sz--;
}
int main() {
  scanf("%I64d%I64d%I64d", &n, &m, &k);
  for (long long i = 1; i <= n; i++) scanf("%I64d", &c[i]), fa[i] = i;
  for (long long i = 1; i <= m; i++)
    scanf("%I64d%I64d", &a[i].u, &a[i].v), a[i].x = c[a[i].u] ^ c[a[i].v];
  sort(a + 1, a + m + 1, cmp);
  for (long long i = 1; i <= m;) {
    long long j = i;
    sz = n;
    for (auto x : s) fa[x] = x;
    s.clear();
    while (j <= m && a[j].x == a[i].x) add(a[j].u, a[j].v), j++;
    i = j, cnt++, ans += qow(2, sz), ans %= 1000000007;
  }
  return printf("%I64d\n", (ans + (qow(2, k) + 1000000007 - cnt) * qow(2, n) %
                                      1000000007) %
                               1000000007),
         0;
}
