#include <bits/stdc++.h>
using namespace std;
const int MAX = 31625;
vector<int> P;
bitset<MAX> viz;
map<int, int> IND;
int cate[114][MAX];
int a[MAX], b[MAX];
int cap[214][214];
int flow[214][214];
int tata[214];
int v[MAX];
vector<int> gr[MAX];
inline void do_the_job(int n, int i) {
  int q = 0;
  for (auto x : P) {
    ++q;
    while (n % x == 0) {
      cate[i][q]++;
      n /= x;
    }
  }
  if (n > 1) {
    if (IND[n] == 0) {
      P.push_back(n);
      IND[n] = P.size();
    }
    cate[i][IND[n]]++;
  }
}
int n;
queue<int> Q;
inline int bfs() {
  Q.push(0);
  for (int i = 0; i <= (n << 1 | 1); ++i) viz[i] = 0;
  viz[0] = 1;
  while (!Q.empty()) {
    int nod = Q.front();
    Q.pop();
    if (nod == (n << 1 | 1)) continue;
    for (auto x : gr[nod]) {
      if (cap[nod][x] == flow[nod][x] or viz[x]) continue;
      Q.push(x);
      tata[x] = nod;
      viz[x] = 1;
    }
  }
  return viz[n << 1 | 1];
}
int main() {
  ios ::sync_with_stdio(false);
  for (int i = 2; i <= 31623; ++i)
    if (viz[i] == 0) {
      P.push_back(i);
      for (int j = i + i; j <= 31623; j += i) viz[j] = 1;
    }
  viz.reset();
  int m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    do_the_job(v[i], i);
    gr[0].push_back(i);
    gr[i].push_back(0);
    gr[i + n].push_back(n << 1 | 1);
    gr[n << 1 | 1].push_back(i + n);
  }
  for (int i = 1; i <= m; ++i) {
    cin >> a[i] >> b[i];
    gr[a[i]].push_back(b[i] + n);
    gr[b[i] + n].push_back(a[i]);
    gr[b[i]].push_back(a[i] + n);
    gr[a[i] + n].push_back(b[i]);
  }
  int q = 0;
  int CET = 0;
  for (auto x : P) {
    ++q;
    memset(cap, 0, sizeof cap);
    memset(flow, 0, sizeof flow);
    for (int i = 1; i <= n; ++i) {
      cap[0][i] = cate[i][q];
      cap[i + n][n << 1 | 1] = cate[i][q];
    }
    for (int i = 1; i <= m; ++i)
      cap[a[i]][b[i] + n] = cap[b[i]][a[i] + n] = 1 << 30;
    while (bfs()) {
      for (auto p0rn : gr[n << 1 | 1]) {
        if (cap[p0rn][n << 1 | 1] == flow[p0rn][n << 1 | 1] or !viz[p0rn])
          continue;
        tata[n << 1 | 1] = p0rn;
        tata[0] = -1;
        int local = 1 << 30;
        for (int i = n << 1 | 1; tata[i] != -1; i = tata[i])
          local = min(local, cap[tata[i]][i] - flow[tata[i]][i]);
        if (local == 0) continue;
        for (int i = n << 1 | 1; tata[i] != -1; i = tata[i]) {
          flow[tata[i]][i] += local;
          flow[i][tata[i]] -= local;
        }
        CET += local;
      }
    }
  }
  cout << (CET >> 1) << '\n';
  return 0;
}

### Prompt

Please formulate a Cpp solution to 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 MAX = 31625;
vector<int> P;
bitset<MAX> viz;
map<int, int> IND;
int cate[114][MAX];
int a[MAX], b[MAX];
int cap[214][214];
int flow[214][214];
int tata[214];
int v[MAX];
vector<int> gr[MAX];
inline void do_the_job(int n, int i) {
  int q = 0;
  for (auto x : P) {
    ++q;
    while (n % x == 0) {
      cate[i][q]++;
      n /= x;
    }
  }
  if (n > 1) {
    if (IND[n] == 0) {
      P.push_back(n);
      IND[n] = P.size();
    }
    cate[i][IND[n]]++;
  }
}
int n;
queue<int> Q;
inline int bfs() {
  Q.push(0);
  for (int i = 0; i <= (n << 1 | 1); ++i) viz[i] = 0;
  viz[0] = 1;
  while (!Q.empty()) {
    int nod = Q.front();
    Q.pop();
    if (nod == (n << 1 | 1)) continue;
    for (auto x : gr[nod]) {
      if (cap[nod][x] == flow[nod][x] or viz[x]) continue;
      Q.push(x);
      tata[x] = nod;
      viz[x] = 1;
    }
  }
  return viz[n << 1 | 1];
}
int main() {
  ios ::sync_with_stdio(false);
  for (int i = 2; i <= 31623; ++i)
    if (viz[i] == 0) {
      P.push_back(i);
      for (int j = i + i; j <= 31623; j += i) viz[j] = 1;
    }
  viz.reset();
  int m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    do_the_job(v[i], i);
    gr[0].push_back(i);
    gr[i].push_back(0);
    gr[i + n].push_back(n << 1 | 1);
    gr[n << 1 | 1].push_back(i + n);
  }
  for (int i = 1; i <= m; ++i) {
    cin >> a[i] >> b[i];
    gr[a[i]].push_back(b[i] + n);
    gr[b[i] + n].push_back(a[i]);
    gr[b[i]].push_back(a[i] + n);
    gr[a[i] + n].push_back(b[i]);
  }
  int q = 0;
  int CET = 0;
  for (auto x : P) {
    ++q;
    memset(cap, 0, sizeof cap);
    memset(flow, 0, sizeof flow);
    for (int i = 1; i <= n; ++i) {
      cap[0][i] = cate[i][q];
      cap[i + n][n << 1 | 1] = cate[i][q];
    }
    for (int i = 1; i <= m; ++i)
      cap[a[i]][b[i] + n] = cap[b[i]][a[i] + n] = 1 << 30;
    while (bfs()) {
      for (auto p0rn : gr[n << 1 | 1]) {
        if (cap[p0rn][n << 1 | 1] == flow[p0rn][n << 1 | 1] or !viz[p0rn])
          continue;
        tata[n << 1 | 1] = p0rn;
        tata[0] = -1;
        int local = 1 << 30;
        for (int i = n << 1 | 1; tata[i] != -1; i = tata[i])
          local = min(local, cap[tata[i]][i] - flow[tata[i]][i]);
        if (local == 0) continue;
        for (int i = n << 1 | 1; tata[i] != -1; i = tata[i]) {
          flow[tata[i]][i] += local;
          flow[i][tata[i]] -= local;
        }
        CET += local;
      }
    }
  }
  cout << (CET >> 1) << '\n';
  return 0;
}

```