#include <bits/stdc++.h>
using namespace std;
int n, m;
int arr[1001];
long double expected[1001][1001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = int(1); i <= int(n); i++) cin >> arr[i];
  for (int i = int(1); i <= int(n); i++) {
    for (int j = int(1); j <= int(n); j++) {
      if (arr[i] > arr[j])
        expected[i][j] = 1;
      else
        expected[i][j] = 0;
    }
  }
  while (m--) {
    int u, v;
    cin >> u >> v;
    for (int i = int(1); i <= int(n); i++) {
      if (i == u || i == v) continue;
      long double x = expected[u][i];
      long double y = expected[v][i];
      expected[u][i] = 0.5 * (x + y);
      expected[v][i] = 0.5 * (x + y);
      x = expected[i][u];
      y = expected[i][v];
      expected[i][u] = 0.5 * (x + y);
      expected[i][v] = 0.5 * (x + y);
    }
    long double x = expected[u][v];
    long double y = expected[v][u];
    expected[u][v] = 0.5 * (x + y);
    expected[v][u] = 0.5 * (x + y);
  }
  long double tot = 0;
  for (int i = int(1); i <= int(n); i++) {
    for (int j = int(i + 1); j <= int(n); j++) tot += expected[i][j];
  }
  cout << std::fixed;
  cout << setprecision(9) << tot;
}
