#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long to, cost;
};
long long ans;
long long n;
long long a[311111];
long long C[55][55];
void comb_table(long long N) {
  for (long long i = 0; i <= N; ++i) {
    for (long long j = 0; j <= i; ++j) {
      if (j == 0 or j == i) {
        C[i][j] = 1LL;
      } else {
        C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);
      }
    }
  }
}
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long repu = 1;
  for (long long i = 0; i < 60; i++) {
    long long num = 1LL << i;
    long long t = 0, f = 0;
    for (long long j = 0; j < n; j++) {
      if (a[j] & num)
        t++;
      else
        f++;
    }
    ans += (t * f * num) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
