#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') X = X * 10 + c - '0', c = getchar();
  return X * w;
}
const int N = 1000 + 10;
int n, m, a[N];
double f[N][N];
int main() {
  n = read(), m = read();
  for (register int i = 1; i <= n; ++i) a[i] = read();
  for (register int i = 1; i <= n; ++i)
    for (register int j = 1; j <= n; ++j) f[i][j] = (a[i] > a[j]);
  while (m--) {
    int x = read(), y = read();
    for (register int i = 1; i <= n; ++i) {
      f[x][i] = f[y][i] = (f[x][i] + f[y][i]) / 2;
      f[i][x] = f[i][y] = 1 - f[x][i];
    }
    f[x][y] = f[y][x] = 0.5;
  }
  double ans = 0;
  for (register int i = 1; i <= n; ++i)
    for (register int j = i + 1; j <= n; ++j) ans += f[i][j];
  printf("%.9lf\n", ans);
  return 0;
}
