#include <bits/stdc++.h>
double p[1010][1010];
int a[1010];
int n, m;
int main() {
  double t, ans;
  int i, j, x, y;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (a[i] > a[j])
        p[i][j] = 1;
      else
        p[i][j] = 0;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    p[x][y] = 0.5;
    p[y][x] = 0.5;
    for (j = 1; j <= n; j++)
      if ((j != x) && (j != y)) {
        t = (p[j][x] + p[j][y]) * 0.5;
        p[j][x] = t;
        p[x][j] = 1 - t;
        p[j][y] = t;
        p[y][j] = 1 - t;
      }
  }
  ans = 0;
  for (i = 1; i <= n - 1; i++)
    for (j = i + 1; j <= n; j++) ans += p[i][j];
  printf("%.10lf\n", ans);
  return 0;
}
