#include <bits/stdc++.h>
using namespace std;
int n, m;
double g[1024][1024], r;
int p[1024];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) scanf("%d", p + i);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    for (int j = 0, ThxDem = n; j < ThxDem; ++j) g[i][j] = p[i] > p[j];
  for (int _ = 0, ThxDem = m; _ < ThxDem; ++_) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
      if (i == a || i == b) continue;
      g[i][a] = g[i][b] = (g[i][a] + g[i][b]) / 2;
      g[b][i] = g[a][i] = 1 - g[i][a];
    }
    g[a][b] = g[b][a] = .5;
  }
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    for (int j = i + 1, ThxDem = n; j < ThxDem; ++j) r += g[i][j];
  printf("%.12lf\n", r);
  return 0;
}
