#include <bits/stdc++.h>
using namespace std;
int n, m, a[1010];
double probBig[1010][1010];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  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++)
      if (a[i] > a[j]) probBig[i][j] = 1;
  for (int i = (1); i <= (m); i++) {
    int u, v;
    cin >> u >> v;
    if (u > v) swap(u, v);
    probBig[u][v] = probBig[v][u] = 0.5;
    for (int j = (1); j <= (n); j++) {
      if (j == u || j == v) continue;
      probBig[j][u] = probBig[j][v] = probBig[j][u] / 2 + probBig[j][v] / 2;
      probBig[u][j] = 1 - probBig[j][u];
      probBig[v][j] = 1 - probBig[j][v];
    }
  }
  double res = 0;
  for (int i = (1); i <= (n); i++)
    for (int j = (i + 1); j <= (n); j++) res += probBig[i][j];
  cout << fixed << setprecision(9) << res;
  return 0;
}
