#include <bits/stdc++.h>
double dp[2005][2005], r[2005];
int n, m, a[2005];
int main() {
  scanf("%d%d", &n, &m);
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      dp[i][j] = a[i] > a[j];
    }
  }
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x == y) continue;
    for (i = 1; i <= n; i++) {
      if (i != x && i != y) {
        r[i] = dp[x][i];
        dp[x][i] = (dp[x][i] + dp[y][i]) * 0.5;
        dp[i][x] = 1 - dp[x][i];
      }
    }
    for (i = 1; i <= n; i++) {
      if (i != x && i != y) {
        dp[y][i] = (r[i] + dp[y][i]) * 0.5;
        dp[i][y] = 1 - dp[y][i];
      }
    }
    dp[y][x] = dp[x][y] = 0.5;
  }
  double ans = 0;
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= i - 1; j++) ans += dp[j][i];
  }
  printf("%.8lf", ans);
  return 0;
}
