#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:200000000")
const double EPS = 1E-9;
const int INF = 1000000000;
const long long INF64 = (long long)1E18;
const double PI = 3.1415926535897932384626433832795;
double p[1100][1100], pv1[1100], pv2[1100];
int a[1100];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(n); j++) p[i][j] = int(a[i] < a[j]);
  for (int ii = 0; ii < (int)(m); ii++) {
    int v1, v2;
    cin >> v1 >> v2;
    v1--;
    v2--;
    memcpy(pv1, p[v1], sizeof(pv1));
    memcpy(pv2, p[v2], sizeof(pv2));
    for (int i = 0; i < (int)(n); i++) {
      p[v1][i] = pv1[i] * 0.5 + pv2[i] * 0.5;
      p[i][v1] = 1 - p[v1][i];
    }
    for (int i = 0; i < (int)(n); i++) {
      p[v2][i] = pv1[i] * 0.5 + pv2[i] * 0.5;
      p[i][v2] = 1 - p[v2][i];
    }
    p[v1][v2] = p[v2][v1] = 0.5;
  }
  double sum = 0;
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(i); j++) sum += p[i][j];
  printf("%.20lf\n", sum);
  return 0;
}
