#include <bits/stdc++.h>
using namespace std;
int N, M, X[1005];
double A[1005][1005];
void print() {
  double Ans = 0;
  for (int i = (1); i <= (N); i++) {
    for (int j = (1); j <= (N); j++) printf("%f ", A[i][j]);
    printf("\n");
  }
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = (1); i <= (N); i++) scanf("%d", &X[i]);
  for (int i = (1); i <= (N); i++)
    for (int j = (1); j <= (N); j++)
      if (X[i] > X[j]) A[i][j] = 1;
  for (int i = (1); i <= (M); i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    A[a][b] = A[b][a] = 0.5;
    for (int i = (1); i <= (N); i++)
      if (i != a && i != b) {
        A[a][i] = A[b][i] = (A[a][i] + A[b][i]) / 2;
        A[i][a] = A[i][b] = (A[i][a] + A[i][b]) / 2;
      }
  }
  double Ans = 0;
  for (int i = (1); i <= (N); i++)
    for (int j = (i + 1); j <= (N); j++) Ans += A[i][j];
  printf("%.10f\n", Ans);
}
