#include <bits/stdc++.h>
using namespace std;
int n, m, a[2100], x, y;
double p[2100][2100], ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) p[i][j] = a[i] > a[j];
  while (m--) {
    cin >> x >> y;
    p[x][y] = p[y][x] = 0.5;
    for (int i = 1; i <= n; ++i)
      if (x != i && y != i)
        p[x][i] = p[y][i] = (p[x][i] + p[y][i]) / 2,
        p[i][x] = p[i][y] = (p[i][x] + p[i][y]) / 2;
  }
  for (int i = 1; i <= n - 1; ++i)
    for (int j = i + 1; j <= n; ++j) ans += p[i][j];
  printf("%.10lf\n", ans);
  return 0;
}
