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