#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int INF = 1e9;
int a[N], n, m;
vector<pair<pair<int, int>, int> > f[N];
int s, t, id;
const int MAXN = 12 * N;
const int MAXM = 12 * N * 10;
struct _edge {
  int from, to, next, cap, flow;
} edge[MAXM];
int tol;
int head[MAXN];
void init() {
  s = 0, t = 1;
  tol = 2;
  memset(head, -1, sizeof(head));
}
inline void addedge(int u, int v, int cap, int rw = 0) {
  edge[tol].from = u;
  edge[tol].to = v;
  edge[tol].cap = cap;
  edge[tol].flow = 0;
  edge[tol].next = head[u];
  head[u] = tol++;
  edge[tol].from = v;
  edge[tol].to = u;
  edge[tol].cap = rw;
  edge[tol].flow = 0;
  edge[tol].next = head[v];
  head[v] = tol++;
}
void build_graph() {
  init();
  for (int i = 1; i <= n; i += 2) {
    for (unsigned j = 0; j < f[i].size(); j++) {
      addedge(s, f[i][j].second, f[i][j].first.second);
    }
  }
  for (int i = 2; i <= n; i += 2) {
    for (unsigned j = 0; j < f[i].size(); j++) {
      addedge(f[i][j].second, t, f[i][j].first.second);
    }
  }
  int x, y;
  while (m--) {
    cin >> x >> y;
    if (y & 1) swap(x, y);
    int p1 = 0, p2 = 0, sz1 = f[x].size(), sz2 = f[y].size();
    while (p1 < sz1 && p2 < sz2) {
      if (f[x][p1].first.first == f[y][p2].first.first) {
        addedge(f[x][p1].second, f[y][p2].second, INF);
        p1++, p2++;
      } else if (f[x][p1].first.first < f[y][p2].first.first) {
        p1++;
      } else {
        p2++;
      }
    }
  }
}
int Q[MAXN];
int dep[MAXN], cur[MAXN], sta[MAXN];
bool bfs(int s, int t, int n) {
  int front = 0, tail = 0;
  memset(dep, -1, sizeof(dep[0]) * (n + 1));
  dep[s] = 0;
  Q[tail++] = s;
  while (front < tail) {
    int u = Q[front++];
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].to;
      if (edge[i].cap > edge[i].flow && dep[v] == -1) {
        dep[v] = dep[u] + 1;
        if (v == t) return true;
        Q[tail++] = v;
      }
    }
  }
  return false;
}
int dinic(int s, int t, int n) {
  int maxflow = 0;
  while (bfs(s, t, n)) {
    for (int i = 0; i < n; i++) cur[i] = head[i];
    int u = s, tail = 0;
    while (cur[s] != -1) {
      if (u == t) {
        int tp = INF;
        for (int i = tail - 1; i >= 0; i--) {
          tp = min(tp, edge[sta[i]].cap - edge[sta[i]].flow);
        }
        maxflow += tp;
        for (int i = tail - 1; i >= 0; i--) {
          edge[sta[i]].flow += tp;
          edge[sta[i] ^ 1].flow -= tp;
          if (edge[sta[i]].cap - edge[sta[i]].flow == 0) tail = i;
        }
        u = edge[sta[tail] ^ 1].to;
      } else if (cur[u] != -1 && edge[cur[u]].cap > edge[cur[u]].flow &&
                 dep[u] + 1 == dep[edge[cur[u]].to]) {
        sta[tail++] = cur[u];
        u = edge[cur[u]].to;
      } else {
        while (u != s && cur[u] == -1) u = edge[sta[--tail] ^ 1].to;
        cur[u] = edge[cur[u]].next;
      }
    }
  }
  return maxflow;
}
int main() {
  while (cin >> n >> m) {
    id = 2;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
      int t = a[i];
      f[i].clear();
      for (int j = 2; j * j <= t; j++) {
        int cnt = 0;
        if (t % j) continue;
        while (t % j == 0) cnt++, t /= j;
        f[i].push_back(pair<pair<int, int>, int>(pair<int, int>(j, cnt), id++));
      }
      if (t > 1) {
        f[i].push_back(pair<pair<int, int>, int>(pair<int, int>(t, 1), id++));
      }
    }
    build_graph();
    cout << dinic(s, t, id) << endl;
  }
  return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), (i2, j2), ..., (im, jm). Each good pair (ik, jk) meets the following conditions: ik + jk is an odd number and 1 ≤ ik < jk ≤ n.

In one operation you can perform a sequence of actions: 

  * take one of the good pairs (ik, jk) and some integer v (v > 1), which divides both numbers a[ik] and a[jk]; 
  * divide both numbers by v, i. e. perform the assignments: <image> and <image>. 



Determine the maximum number of operations you can sequentially perform on the given array. Note that one pair may be used several times in the described operations.

Input

The first line contains two space-separated integers n, m (2 ≤ n ≤ 100, 1 ≤ m ≤ 100).

The second line contains n space-separated integers a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109) — the description of the array.

The following m lines contain the description of good pairs. The k-th line contains two space-separated integers ik, jk (1 ≤ ik < jk ≤ n, ik + jk is an odd number).

It is guaranteed that all the good pairs are distinct.

Output

Output the answer for the problem.

Examples

Input

3 2
8 3 8
1 2
2 3


Output

0


Input

3 2
8 12 8
1 2
2 3


Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int INF = 1e9;
int a[N], n, m;
vector<pair<pair<int, int>, int> > f[N];
int s, t, id;
const int MAXN = 12 * N;
const int MAXM = 12 * N * 10;
struct _edge {
  int from, to, next, cap, flow;
} edge[MAXM];
int tol;
int head[MAXN];
void init() {
  s = 0, t = 1;
  tol = 2;
  memset(head, -1, sizeof(head));
}
inline void addedge(int u, int v, int cap, int rw = 0) {
  edge[tol].from = u;
  edge[tol].to = v;
  edge[tol].cap = cap;
  edge[tol].flow = 0;
  edge[tol].next = head[u];
  head[u] = tol++;
  edge[tol].from = v;
  edge[tol].to = u;
  edge[tol].cap = rw;
  edge[tol].flow = 0;
  edge[tol].next = head[v];
  head[v] = tol++;
}
void build_graph() {
  init();
  for (int i = 1; i <= n; i += 2) {
    for (unsigned j = 0; j < f[i].size(); j++) {
      addedge(s, f[i][j].second, f[i][j].first.second);
    }
  }
  for (int i = 2; i <= n; i += 2) {
    for (unsigned j = 0; j < f[i].size(); j++) {
      addedge(f[i][j].second, t, f[i][j].first.second);
    }
  }
  int x, y;
  while (m--) {
    cin >> x >> y;
    if (y & 1) swap(x, y);
    int p1 = 0, p2 = 0, sz1 = f[x].size(), sz2 = f[y].size();
    while (p1 < sz1 && p2 < sz2) {
      if (f[x][p1].first.first == f[y][p2].first.first) {
        addedge(f[x][p1].second, f[y][p2].second, INF);
        p1++, p2++;
      } else if (f[x][p1].first.first < f[y][p2].first.first) {
        p1++;
      } else {
        p2++;
      }
    }
  }
}
int Q[MAXN];
int dep[MAXN], cur[MAXN], sta[MAXN];
bool bfs(int s, int t, int n) {
  int front = 0, tail = 0;
  memset(dep, -1, sizeof(dep[0]) * (n + 1));
  dep[s] = 0;
  Q[tail++] = s;
  while (front < tail) {
    int u = Q[front++];
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].to;
      if (edge[i].cap > edge[i].flow && dep[v] == -1) {
        dep[v] = dep[u] + 1;
        if (v == t) return true;
        Q[tail++] = v;
      }
    }
  }
  return false;
}
int dinic(int s, int t, int n) {
  int maxflow = 0;
  while (bfs(s, t, n)) {
    for (int i = 0; i < n; i++) cur[i] = head[i];
    int u = s, tail = 0;
    while (cur[s] != -1) {
      if (u == t) {
        int tp = INF;
        for (int i = tail - 1; i >= 0; i--) {
          tp = min(tp, edge[sta[i]].cap - edge[sta[i]].flow);
        }
        maxflow += tp;
        for (int i = tail - 1; i >= 0; i--) {
          edge[sta[i]].flow += tp;
          edge[sta[i] ^ 1].flow -= tp;
          if (edge[sta[i]].cap - edge[sta[i]].flow == 0) tail = i;
        }
        u = edge[sta[tail] ^ 1].to;
      } else if (cur[u] != -1 && edge[cur[u]].cap > edge[cur[u]].flow &&
                 dep[u] + 1 == dep[edge[cur[u]].to]) {
        sta[tail++] = cur[u];
        u = edge[cur[u]].to;
      } else {
        while (u != s && cur[u] == -1) u = edge[sta[--tail] ^ 1].to;
        cur[u] = edge[cur[u]].next;
      }
    }
  }
  return maxflow;
}
int main() {
  while (cin >> n >> m) {
    id = 2;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
      int t = a[i];
      f[i].clear();
      for (int j = 2; j * j <= t; j++) {
        int cnt = 0;
        if (t % j) continue;
        while (t % j == 0) cnt++, t /= j;
        f[i].push_back(pair<pair<int, int>, int>(pair<int, int>(j, cnt), id++));
      }
      if (t > 1) {
        f[i].push_back(pair<pair<int, int>, int>(pair<int, int>(t, 1), id++));
      }
    }
    build_graph();
    cout << dinic(s, t, id) << endl;
  }
  return 0;
}

```