#include <bits/stdc++.h>
using namespace std;
const int TAM = 1e3 + 10;
int arr[TAM];
double p[TAM][TAM];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (arr[i] > arr[j])
        p[i][j] = 1.0;
      else
        p[i][j] = 0.0;
  int i, j;
  for (int k = 0; k < m; k++) {
    cin >> i >> j;
    i--;
    j--;
    if (i > j) swap(i, j);
    p[i][j] = p[j][i] = 0.5;
    for (int l = 0; l < n; l++) {
      if (l == i || l == j) continue;
      p[i][l] = p[j][l] = (p[i][l] + p[j][l]) / 2.0;
      p[l][i] = p[l][j] = 1.0 - p[i][l];
    }
  }
  double ans = 0.0;
  for (i = 0; i < n; i++)
    for (j = i + 1; j < n; j++) ans += p[i][j];
  cout << fixed << setprecision(13) << ans << endl;
  return 0;
}
