#include <bits/stdc++.h>
using namespace std;
struct node {
  int data;
  node *next;
} * ge[3000], edge[6000];
int q[3000], d[3000], cnt[3001];
void insertEdge(int a, int b) {
  static int top = 0;
  node *p = &edge[top++];
  p->data = b;
  p->next = ge[a];
  ge[a] = p;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) ge[i] = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    insertEdge(a, b);
    insertEdge(b, a);
  }
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; i++) {
    memset(d, -1, sizeof(d));
    d[i] = 1;
    int head = 0, tail = 1;
    q[0] = i;
    while (head < tail) {
      int now = q[head++];
      for (node *p = ge[now]; p; p = p->next)
        if (d[p->data] == -1) {
          d[p->data] = d[now] + 1;
          q[tail++] = p->data;
        }
    }
    for (int j = 0; j < n; j++) cnt[d[j]]++;
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) ans += (double)cnt[i] / i;
  printf("%.10lf\n", ans);
  return 0;
}
