#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
template <class T>
inline void read(T& x, T& y) {
  read(x);
  read(y);
}
template <class T>
inline void read(T& x, T& y, T& z) {
  read(x);
  read(y);
  read(z);
}
template <class T>
inline void read(T& x, T& y, T& z, T& q) {
  read(x);
  read(y);
  read(z);
  read(q);
}
inline char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
int n, m, x, y, i, j, a[1111];
long double p[1001][1001];
int main() {
  read(n, m);
  for (i = 1; i <= n; i++) read(a[i]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) p[i][j] = a[i] > a[j];
  for (; m; m--) {
    read(x, y);
    p[x][y] = p[y][x] = 0.5;
    for (i = 1; i <= n; i++)
      if (i != x && i != y)
        p[i][x] = p[i][y] = (p[i][x] + p[i][y]) / 2,
        p[x][i] = p[y][i] = (p[x][i] + p[y][i]) / 2;
  }
  long double ans = 0;
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) ans += p[i][j];
  cout << fixed << setprecision(10) << ans << endl;
  scanf("\n");
  return 0;
}
