#include <bits/stdc++.h>
using namespace std;
int n, m, a[1005];
double ans, f[1005][1005];
int main() {
  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 = i + 1; j <= n; j++)
      if (a[i] > a[j])
        f[i][j] = 1.0;
      else
        f[j][i] = 1.0;
  int x, y;
  while (m--) {
    scanf("%d%d", &x, &y);
    if (x == y) continue;
    for (int i = 1; i <= n; i++) {
      if (i == x || i == y) continue;
      f[i][x] = f[i][y] = (f[i][x] + f[i][y]) / 2;
      f[x][i] = f[y][i] = (f[x][i] + f[y][i]) / 2;
    }
    f[x][y] = f[y][x] = 0.5;
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += f[i][j];
  printf("%.8f", ans);
  return 0;
}
