#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T &ans, T t) {
  if (t > ans) ans = t;
}
template <class T>
inline void chmin(T &ans, T t) {
  if (t < ans) ans = t;
}
long long digit[100010][70][2];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<long long> two(70, 0);
  long long tw = 1;
  long long cnt = 0;
  while (cnt < 62) {
    two[cnt] = tw % 1000000007;
    tw *= 2;
    cnt++;
  }
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long cp = a[i];
    for (int t = 0; t < 70; ++t) {
      if (cp & 1) {
        digit[i + 1][t][1] = (digit[i][t][1] + two[t]) % 1000000007;
        digit[i + 1][t][0] = (digit[i][t][0]) % 1000000007;
      } else {
        digit[i + 1][t][1] = (digit[i][t][1]) % 1000000007;
        digit[i + 1][t][0] = (digit[i][t][0] + two[t]) % 1000000007;
      }
      cp >>= 1;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    long long cp = a[i];
    for (int t = 0; t < 70; ++t) {
      long long one = 1000000007 + digit[n][t][1] - digit[i][t][1];
      long long zero = 1000000007 + digit[n][t][0] - digit[i][t][0];
      if (cp & 1) {
        ans += zero % 1000000007;
      } else {
        ans += one % 1000000007;
      }
      cp >>= 1;
    }
  }
  cout << ans % 1000000007 << endl;
}
