#include <bits/stdc++.h>
using namespace std;
double f[2001][2001];
int a[2001];
int n, m;
int main() {
  int x, y;
  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;
  for (int j = 1; j <= m; j++) {
    scanf("%d%d", &x, &y);
    f[x][y] = f[y][x] = 0.5;
    for (int i = 1; i <= n; i++)
      if (i != x && i != y) {
        f[i][y] = f[i][x] = f[i][x] / 2.0 + f[i][y] / 2.0;
        f[x][i] = f[y][i] = f[x][i] / 2.0 + f[y][i] / 2.0;
      }
  }
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += f[i][j];
  printf("%.10f\n", ans);
  fclose(stdin);
  return 0;
}
