#include <bits/stdc++.h>
using namespace std;
const int MAX = 1001;
double vers[MAX][MAX];
int s[MAX], a[MAX], b[MAX];
int n, m;
bool solve() {
  if (scanf("%d%d", &n, &m) == EOF) return false;
  for (int i = 0; i < n; ++i) scanf("%d", &s[i]);
  for (int i = 0; i < m; ++i) scanf("%d%d", &a[i], &b[i]);
  memset(vers, 0, sizeof(vers));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) vers[i][j] = i > j;
  for (int i = m - 1; i >= 0; --i) {
    for (int j = 0; j < n; ++j) {
      if (j + 1 != a[i] && j + 1 != b[i]) {
        vers[a[i] - 1][j] = vers[b[i] - 1][j] =
            (vers[a[i] - 1][j] + vers[b[i] - 1][j]) / 2;
        vers[j][a[i] - 1] = vers[j][b[i] - 1] =
            (vers[j][a[i] - 1] + vers[j][b[i] - 1]) / 2;
      }
    }
    vers[a[i] - 1][b[i] - 1] = vers[b[i] - 1][a[i] - 1] =
        (vers[a[i] - 1][b[i] - 1] + vers[b[i] - 1][a[i] - 1]) / 2;
  }
  double ans = 0;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (s[i] < s[j])
        ans += vers[i][j];
      else if (s[i] > s[j])
        ans += 1 - vers[i][j];
  printf("%.10lf\n", ans);
  return true;
}
int main() {
  solve();
  return 0;
}
