#include <bits/stdc++.h>
using namespace std;
int n, m;
double ans;
int a[1010];
struct ao {
  int s, t;
} b[1010];
double f[1010][1010];
int main() {
  int i, j, x, y;
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= m; i++) cin >> b[i].s >> b[i].t;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      f[i][j] = (a[i] > a[j] ? 1 : 0);
    }
  for (i = 1; i <= m; i++) {
    x = b[i].s, y = b[i].t;
    for (j = 1; j <= n; j++) {
      if (j != x && j != y) {
        f[j][x] = f[j][y] = (f[j][x] + f[j][y]) / 2;
        f[x][j] = f[y][j] = (f[x][j] + f[y][j]) / 2;
      }
    }
    f[x][y] = f[y][x] = (f[x][y] + f[y][x]) / 2;
  }
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) ans += f[i][j];
  printf("%.8lf", ans);
  return 0;
}
