#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int n, m, a[maxn];
double p[maxn][maxn];
int main() {
  int u, v;
  while (scanf("%d%d", &n, &m) != EOF) {
    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++) p[i][j] = (a[i] > a[j]) ? 1.0 : 0.0;
    for (int i = 0; i != m; i++) {
      scanf("%d%d", &u, &v);
      p[u][v] = p[v][u] = 0.5;
      for (int k = 1; k <= n; k++)
        if (u != k && v != k) {
          p[u][k] = p[v][k] = (p[u][k] + p[v][k]) * 0.5;
          p[k][u] = p[k][v] = (p[k][u] + p[k][v]) * 0.5;
        }
    }
    double ans = 0;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++) ans += p[i][j];
    printf("%.6lf\n", ans);
  }
  return 0;
}
