#include <bits/stdc++.h>
using namespace std;
inline int Get() {
  int res = 0, q = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') q = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') res = res * 10 + ch - '0', ch = getchar();
  return res * q;
}
const double eps = 1e-12, pi = M_PI;
const int oo = (int)2e9, mod = (int)1e9 + 7;
const long long INF = (long long)1e17;
const int N = 1000;
double f[N + 10][N + 10];
int n, m, a[N + 10], j, k;
int main() {
  scanf(
      "%d"
      "%d"
      "\n",
      &n, &m);
  for (int i = (1), end = (n); i <= end; ++i) scanf("%d", a + i);
  for (int i = (1), end = (n - 1); i <= end; ++i) {
    for (int j = (i + 1), end = (n); j <= end; ++j) {
      f[i][j] = (a[i] > a[j]), f[j][i] = 1 - f[i][j];
    }
  }
  for (; m--;) {
    scanf(
        "%d"
        "%d"
        "\n",
        &j, &k);
    f[j][k] = f[k][j] = 0.5;
    for (int i = (1), end = (n); i <= end; ++i)
      if (i != j && i != k) {
        f[i][j] = f[i][k] = (f[i][j] + f[i][k]) / 2;
        f[j][i] = 1 - f[i][j], f[k][i] = 1 - f[i][k];
      }
  }
  double ans = 0;
  for (int i = (1), end = (n - 1); i <= end; ++i) {
    for (int j = (i + 1), end = (n); j <= end; ++j) ans += f[i][j];
  }
  printf(
      "%.10lf"
      "\n",
      ans);
  return 0;
}
