#include <bits/stdc++.h>
using namespace std;
double f[1001][1001];
int a[1001];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) f[i][j] = (a[i] > a[j]);
  while (m--) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    f[u][v] = f[v][u] = 0.5;
    for (int i = 0; i < n; i++) {
      if (i != u && i != v) {
        f[u][i] = f[v][i] = (f[u][i] + f[v][i]) * 0.5;
        f[i][u] = f[i][v] = (f[i][u] + f[i][v]) * 0.5;
      }
    }
  }
  double ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) ans += f[i][j];
  printf("%.8lf\n", ans);
}
