#include <bits/stdc++.h>
using namespace std;
namespace FGF {
int n, m;
const int N = 3005, mo = 1e9 + 7, inv2 = (mo + 1) / 2;
int a[N];
double f[N][N], ans;
void work() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) f[i][j] = (a[i] > a[j]);
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y);
    f[x][y] = f[y][x] = (f[x][y] + f[y][x]) / 2.0;
    for (int i = 1; i <= n; i++)
      if (i != x && i != y) {
        f[x][i] = f[y][i] = (f[x][i] + f[y][i]) / 2.0;
        f[i][x] = f[i][y] = (f[i][x] + f[i][y]) / 2.0;
      }
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans += f[i][j];
  printf("%.8f\n", ans);
}
}  // namespace FGF
int main() {
  FGF::work();
  return 0;
}
