#include <bits/stdc++.h>
using namespace std;
const int MX = 1009;
double inv[MX][MX];
int arr[MX], n, m;
int main() {
  cin >> n >> m;
  for (int j = 1; j <= n; j++) {
    cin >> arr[j];
    for (int i = 1; i < j; i++) {
      if (arr[i] > arr[j]) inv[i][j] = 1.0;
      inv[j][i] = 1.0 - inv[i][j];
    }
  }
  cout << fixed << setprecision(10);
  while (m--) {
    int a, b;
    cin >> a >> b;
    inv[a][b] = inv[b][a] = 0.5;
    for (int j = 1; j <= n; j++) {
      if (j == a || j == b) continue;
      long double t1, t2, t3;
      t1 = inv[a][j] * inv[b][j];
      t2 = inv[j][a] * inv[j][b];
      t3 = 1.0 - t1 - t2;
      inv[a][j] = inv[b][j] = (t3 * 0.5 + t1);
      inv[j][a] = inv[j][b] = 1.0 - inv[a][j];
    }
  }
  long double ans = 0.0;
  for (int j = 1; j <= n; j++) {
    for (int i = j + 1; i <= n; i++) ans += inv[j][i];
  }
  cout << ans << endl;
}
