#include <bits/stdc++.h>
using namespace std;
int a[1010];
struct YY {
  int x, y;
} q[1010];
double f[1010][1010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i] > a[j])
        f[i][j] = 1;
      else
        f[i][j] = 0;
  for (int i = 1; i <= m; i++) scanf("%d%d", &q[i].x, &q[i].y);
  for (int i = 1; i <= m; i++) {
    int x = q[i].x, y = q[i].y;
    f[x][y] = f[y][x] = 0.5;
    for (int j = 1; j <= n; j++) {
      if (j == x || j == y) continue;
      f[x][j] = f[y][j] = (f[x][j] + f[y][j]) / 2;
      f[j][x] = f[j][y] = (f[j][x] + f[j][y]) / 2;
    }
  }
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < i; j++) ans += f[j][i];
  printf("%lf", ans);
  return 0;
}
