#include <bits/stdc++.h>
using namespace std;
void run();
int main() {
  ios::sync_with_stdio(0);
  run();
}
long double pre[1000][1000];
int v[1000];
void run() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> v[i], --v[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) pre[i][j] = (v[i] < v[j]);
  for (int i = 0, u, v; i < m; i++)
    for (int j = (cin >> u >> v, --u, --v, pre[u][v] = pre[v][u] = .5L); j < n;
         j++)
      if (u != j and v != j)
        pre[u][j] = pre[v][j] =
            1.L - (pre[j][u] = pre[j][v] = (pre[j][u] + pre[j][v]) / 2.L);
  long double res = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) res += pre[i][j];
  cout.precision(20);
  cout << res << endl;
}
