#include <bits/stdc++.h>
using namespace std;
int n, m, p[1010];
double prob[1010][1010];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", p + i);
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      prob[i][j] = p[i] > p[j];
    }
  while (m--) {
    int l, r;
    scanf("%d %d", &l, &r);
    for (int i = 1; i <= n; ++i)
      if (i != l && i != r) {
        prob[i][l] = prob[i][r] = (prob[i][l] + prob[i][r]) / 2;
        prob[l][i] = prob[r][i] = (prob[l][i] + prob[r][i]) / 2;
      }
    prob[l][r] = prob[r][l] = 0.5;
  }
  double ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      ans += prob[i][j];
    }
  printf("%.9lf\n", ans);
}
