#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
inline int rd() {
  int res = 0, f = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) res = res * 10 + ch - 48;
  return f ? -res : res;
}
int n, m, x[maxn], y[maxn], ch[maxn];
double f[maxn][maxn];
int main() {
  n = rd();
  m = rd();
  for (register int i = 1; i <= n; i++) ch[i] = rd();
  for (register int i = 1; i <= m; i++) {
    x[i] = rd();
    y[i] = rd();
  }
  for (register int i = 1; i <= n; i++)
    for (register int j = 1; j <= n; j++)
      if (ch[i] > ch[j])
        f[i][j] = 1.0;
      else
        f[i][j] = 0.0;
  for (register int i = 1; i <= m; i++) {
    int x0 = x[i], y0 = y[i];
    for (register int j = 1; j <= n; j++) {
      f[x0][j] = f[y0][j] = (double)(f[x0][j] + f[y0][j]) * 0.5;
      f[j][x0] = f[j][y0] = (double)1.0 - f[x0][j];
    }
    f[x0][y0] = f[y0][x0] = 0.5;
  }
  double ans = 0.0;
  for (register int i = 1; i <= n; i++)
    for (register int j = i + 1; j <= n; j++) ans += (double)f[i][j];
  printf("%.8lf\n", ans);
  return 0;
}
