#include <bits/stdc++.h>
using namespace std;
long long a[300005];
int all1[300005][65];
int all0[300005][65];
int main() {
  int n;
  cin >> n;
  int cnt;
  for (int i = 0; i < n; i++) {
    if (i != 0) {
      for (int j = 0; j < 65; j++) {
        all1[i][j] = all1[i - 1][j];
        all0[i][j] = all0[i - 1][j];
      }
    }
    cnt = 0;
    cin >> a[i];
    int tmp = a[i];
    while (tmp != 0) {
      cnt++;
      if (tmp % 2 == 0) {
        all0[i][cnt]++;
      } else if (tmp % 2 == 1) {
        all1[i][cnt]++;
      }
      tmp /= 2;
    }
    for (int j = cnt + 1; j < 65; j++) {
      all0[i][j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int tmp = a[i];
    int cnt = 0;
    for (int j = 0; j < 65; j++) {
      cnt++;
      int wei = tmp % 2;
      if (wei == 1) {
        ans = ans + (1 << (cnt - 1)) % 1000000007 *
                        (all0[n - 1][cnt] - all0[i][cnt]) % 1000000007;
        ans %= 1000000007;
      } else if (wei == 0) {
        ans = ans + (1 << (cnt - 1)) % 1000000007 *
                        (all1[n - 1][cnt] - all1[i][cnt]) % 1000000007;
      }
      tmp /= 2;
    }
  }
  cout << ans;
  return 0;
}
