#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, u, v;
int a[11111];
double mat[1111][1111];
double g;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (a[i] < a[j]) mat[i][j] = 1;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    for (j = 1; j <= n; j++)
      if (j != u && j != v) {
        g = (mat[j][u] + mat[j][v]) / 2;
        mat[j][u] = mat[j][v] = g;
        g = (mat[u][j] + mat[v][j]) / 2;
        mat[u][j] = mat[v][j] = g;
      }
    g = (mat[u][v] + mat[v][u]) / 2;
    mat[u][v] = mat[v][u] = g;
  }
  g = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j < i; j++) g += mat[i][j];
  printf("%.9lf", g);
  return 0;
}
